<%@ include />是在翻译时translation-time起作用,效率高,不能包含servlet
<jsp:include />是在运行时run time才起作用,能获得实时的包含内容,可以包含servlet
同样,在web.xml中定义的
<include-prelude>/header.jsp</include-prelude>
<include-coda>/footer.jsp</include-coda>
也不能包含servlet,他们都是在翻译阶段确定的
<jsp:include />是在运行时run time才起作用,能获得实时的包含内容,可以包含servlet
同样,在web.xml中定义的
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<include-prelude>/header.jsp</include-prelude>
<include-coda>/footer.jsp</include-coda>
</jsp-property-group>
</jsp-config><include-prelude>/header.jsp</include-prelude>
<include-coda>/footer.jsp</include-coda>
也不能包含servlet,他们都是在翻译阶段确定的
本文探讨了JSP页面中使用<%@include file=””%>和<jsp:include page=””/>的区别。前者在翻译阶段进行静态包含,效率较高;后者在运行时动态包含,能获取最新的内容更新。此外,文中还介绍了通过web.xml配置全局包含的方法。
890

被折叠的 条评论
为什么被折叠?



