【发布时间】:2016-05-27 11:54:39
【问题描述】:
我需要一些帮助
我有 header.jsp、login.jps 和 register.jsp。
我使用 Header.jsp 和另一个 JPS 构建我的 Body。 我想根据我构建的 Jsp 更改 Header.jsp 的“帮助”链接。我该怎么做?
我寻找 javascript 解决方案,但它是一个“肮脏”的解决方案,Sonar 说“上帝不要那样做”。
更多细节解释mysefl,我的Header.jsp有那个代码:
<ul class="pull-right">
<c:if test="${empty sessionScope.USER}">
<li><a href="#" class="help"><spring:message code="header.manual"/><span><spring:message code="header.help"/></span></a></li>
</c:if>
如果我使用 Login.jsp 构建,我希望该 href 链接到“url.com/home.public?help_login”,如果是 Register.jsp,我希望 href 喜欢“url.com/home.public?help_register”。
信息:当我使用 register.jsp 时,我的 url 是“url.com/register.public”,否则我使用 login.jsp 我的 url 是“url.com/login.public”。
对不起,如果我的英语不好,但我想你会明白的。
编辑:Layout.jsp
<body class="home" onload="nobackbutton();">
<c:choose>
<c:when test="${not empty sessionScope.ADMIN}">
<tiles:insertAttribute name="headerAdmin" />
<tiles:insertAttribute name="menuAdmin" />
</c:when >
<c:otherwise>
<tiles:insertAttribute name="header" />
<tiles:insertAttribute name="menu" />
</c:otherwise>
</c:choose>
<div class="container-fluid">
<tiles:insertAttribute name="miga" />
<tiles:insertAttribute name="body" />
</div>
</body>
【问题讨论】: