首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JSP包含用于国际化的标记

问JSP包含用于国际化的标记
EN

Stack Overflow用户
提问于 2015-05-07 15:22:07
回答 1查看 599关注 0票数 2

我的JSP (template.jsp)中有这样的结构:

代码语言:javascript
复制
<%@ 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

代码语言:javascript
复制
<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>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-05-07 15:28:21

将这些行放在jsp中&将其包含在当前的jsp i;e template.jsp中,如

代码语言:javascript
复制
<@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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30105351

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档