简体   繁体   English

JSP 服务器错误页面的动态内容

[英]Dynamic content for JSP Server Error Page

I have a questions regarding on how to configure the JSP file for the 500 error page.我对如何为 500 错误页面配置 JSP 文件有疑问。

In this scenario, there are multiple themes with a folder structure described below.在这种情况下,有多个主题具有如下所述的文件夹结构。 All the themes in question use this JSP, but I would need to find a way to change the logo dynamically, so it is not hardcoded in the JSP as well as the css file for this particular JSP file.所有有问题的主题都使用这个 JSP,但我需要找到一种动态更改徽标的方法,因此它不会硬编码在 JSP 以及这个特定 JSP 文件的 css 文件中。

As I tested I see that I cannot use cms tags or templates inside this particular page.正如我测试的那样,我发现我不能在这个特定页面内使用 cms 标签或模板。

在此处输入图像描述

<c:url value="/_ui/responsive/theme-moveit/images/moveit_logo.jpg" var="logo" />
<c:url value="/_ui/responsive/theme-hausmannHaensgen/images/hausmannHaensgen_logo.png" var="logo2" />

<div class="nav__left js-site-logo">
    <a href="${pageContext.request.contextPath}">
        <img src="${logo}" alt="MoveIT24">
        <img src="${logo2}" alt="hausmannHaensgen">
    </a>
</div>

I was wondering on how could I find a way to differentiate between the two themes so I can condition which logo should be shown.我想知道如何找到一种方法来区分这两个主题,以便我可以确定应该显示哪个徽标。 The same idea should be apllied to switch some colors.同样的想法应该适用于切换一些colors。

Any suggestions are highly appreciated, thanks!非常感谢任何建议,谢谢!

I found a solution by using a hidden input and got the URL:我通过使用隐藏输入找到了解决方案并获得了 URL:

<input id="themeName" type="hidden" value="${pageContext.request.serverName}">

I used the server name in a JS function and changed the logo accordingly and created a link tag to use the correct css file.我在 JS function 中使用了服务器名称并相应地更改了徽标并创建了一个链接标记以使用正确的 css 文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM