我对struts2有一个疑问。我有一个这样的header.jsp页面:
<%@taglib prefix="s" uri="/struts-tags" %> <html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
</head>
<body>我的home.jsp页面是这样的:
<%@taglib prefix="s" uri="/struts-tags" %>
<s:include value="/WEB-INF/doctor/header.jsp" ></s:include>
<h1>Hello World!</h1>
<s:include value="/WEB-INF/doctor/footer.jsp" ></s:include>footer.jsp是:
</body>
</html>我的问题是:我是只需要在header.jsp中包含<%@taglib prefix="s" uri="/struts-tags" %>标签,还是需要在header.jsp和home.jsp中都包含它?
发布于 2011-12-07 21:46:15
如果通过动态包含机制(如<s:include>或<jsp:include> )包含JSP文件,则必须声明标记库。以这种方式包含的JSP文件被编译到它们自己的servlet中。
如果它是静态包含的,则不需要声明标记库。静态页面被编译到包含它们的JSP中,并在包含它们的页面的上下文中操作。
https://stackoverflow.com/questions/8410633
复制相似问题