jsp - 如何创建母版页?

标签 jsp templating

我需要在 JSP 中创建一个母版页,供其他 JSP 使用,以使它们具有相同的外观和菜单。我怎样才能在 JSP 中做到这一点?

最佳答案

你可以使用

<%@ include file="/absoluteFragment.jsp" %>
或者
<jsp:include page="relativeDynFragment.jsp" />
要了解差异,另请参阅 http://www.jguru.com/faq/view.jsp?EID=13517 :

The <%@include file="abc.jsp"%> directive acts like C "#include", pulling in the text of the included file and compiling it as if it were part of the including file. The included file can be any type (including HTML or text).

The <jsp:include page="abc.jsp"> tag compiles the file as a separate JSP file, and embeds a call to it in the compiled JSP.

关于jsp - 如何创建母版页?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7872203/

相关文章:

AJAX 从 Spring-MVC Controller 获取数据

java - 显示 sparql 查询的结果 "nicely"

jsp - 检查 JSP 中属性文件的值是否相等

c - C 中的无警告模板

javascript - 使用 JavaScript 查找和替换

twig - 有条件地在 Twig 2 中定义一个 block

php - Laravel 5.x 覆盖特定用户的 View

java - Bean set属性

java - struts2 从带有数据的超链接调用操作

javascript - 无法访问 Nunjucks 模板内嵌套对象中的数据