l
常见的应用:
ü
<%@ include file=“”%>
与
<
jsp:include
page=“”/>
l
一般人不知道的应用:
<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>
l
要生成一批如左图所示的具有相同页眉,页尾,以及左侧栏的页面,这些页面的内容不同,要想充分实现
HTML
代码的复用,每个页面应该用几个局部网页来合成呢?
l
页面布局代码:
<table>
<tr><td colspan=“2”>header</td></tr>
<tr><td>Menu</td><td><jsp:include page=“${body}” />”</td></tr>
<tr><td colspan=“2”>footer</td></tr>
<table>
l
页面布局代码的重用方式:
ü
Apache
的
Tiles
框架
ü
Filter +
布局文件(例如,
Sitemesh
)