我需要在 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/