?? 首先在web.xml文件中加入
<taglib>
??<taglib-uri>/tags/struts-tiles</taglib-uri>
??<taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
?</taglib>
該配置指名了tiles聲明文件struts-tiles的地址,通過上述配置,我們在使用tiles的jsp文件中就只需要加入
<%@ taglib uri="/tags/struts-tiles" prefix="tiles"%>
同時在struts配置文件中,我們需要指名tiles配置文件的地址
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
<plug-in className="org.apache.struts.tiles.TilesPlugin">
??????? <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/>
??????? <set-property property="moduleAware" value="true"/>
</plug-in>
然后我們開始編寫我們的tiles-defs.xml文件
我們做個首頁面試試:
1
<
tiles
-
definitions
>
2
<
definition?name
=
"
web.login
"
?path
=
"
/common/layout/LoginLayout.jsp
"
>
3
????????
<
put?name
=
"
title
"
?value
=
"
XXX系統
"
/>
4
????????
<
put?name
=
"
header
"
?value
=
"
/user/common/common_header1.jsp
"
/>
5
????????
<
put?name
=
"
body
"
?value
=
"
/common/blank.jsp
"
/>
6
????????
<
put?name
=
"
footer
"
?value
=
"
/user/common/common_footer.jsp
"
/>
7
</
definition
>
8
</
tiles
-
definitions
>

2

3

4

5

6

7

8









