当前位置 : 主页 > 编程语言 > java >

jsp – 如何创建母版页?

来源:互联网 收集:自由互联 发布时间:2021-06-25
我需要在JSP中创建一个主页面以供其他JSP使用,以使它们具有相同的外观和菜单.我怎么能在JSP中做到这一点? 你可以使用其中之一 %@ include file="/absoluteFragment.jsp" % 要么 jsp:include page="r
我需要在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.

网友评论