我的JSP (template.jsp)中有这样的结构:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="language" value="es" scope="session"/>
<fmt:setBundle basename="com.myweb.i18n.text"/>
<html>
<body>
<fmt:message key='login.label.username'/>
<jsp:include page='/home/header.jsp' flush='true'/>
<jsp:include page='/home/body.jsp' flush='true'/>
<jsp:include page='/home/footer.jsp' flush='true'/>
</body>
</html>fmt:消息行运行良好(打印文本标签)。但是,如果我用header.jsp或包含的任何其他jsp编写这一行,则不起作用。
我必须在所有jsp文件中写入所有标记库行吗?有没有办法在我所有的jsp中包含不重复的第4行?
谢谢!
编辑:示例header.jsp
<div>
<fmt:message key='login.label.username'/>
<jsp:include page='/home/header-left.jsp' flush='true'/>
<jsp:include page='/home/header-center.jsp' flush='true'/>
<jsp:include page='/home/footer-right.jsp' flush='true'/>
</div>发布于 2015-05-07 15:28:21
将这些行放在jsp中&将其包含在当前的jsp i;e template.jsp中,如
<@include file="path/jspcontaininglibs.jsp"/>
<html>
<body>
<fmt:message key='login.label.username'/>
<jsp:include page='/home/header.jsp' flush='true'/>
<jsp:include page='/home/body.jsp' flush='true'/>
<jsp:include page='/home/footer.jsp' flush='true'/>
</body>
</html>https://stackoverflow.com/questions/30105351
复制相似问题