一基本包(个)
monsloggingjar
monsfileuploadjar
ognljar
strutscorejar
xworkjar
freemarkerjar
二整合tiles必须包(个)
strutstilespluginjar
tilesapijar
tilescorejar
tilesjspjar
monsdigesterjar
monscollectionsjar
monsbeanutilsjar
三把tilesjspjar包下的tilesjsptld 拷贝到WEBINF下WEBINF/tilesjsptld
四创建tilesxml 放在WEBINF下WEBINF/tilesxml 如下:
<?xml version= encoding=UTF?>
<!DOCTYPE tilesdefinitions PUBLIC //Apache Software Foundation//DTD Tiles Configuration //EN /dtds/tilesconfig__dtd>
<tilesdefinitions>
<definition name=xixihaha template=layoutjsp>
<putattribute name=header value=headjsp />
<putattribute name=sidebar value=sidebarjsp />
<putattribute name=contant value=contantjsp />
<putattribute name=footer value=footjsp />
</definition>
</tilesdefinitions>
五在webxml添加如下:
<contextparam>
<paramname>orgapachetilesCONTAINER_FACTORY</paramname>
<paramvalue>orgapachestrutstilesStrutsTilesContainerFactory</paramvalue>
</contextparam>
<contextparam>
<paramname>orgapachetilesimplBasicTilesContainerDEFINITIONS_CONFIG</paramname>
<paramvalue>/WEBINF/tilesxml</paramvalue>
</contextparam>
<listener>
<listenerclass>orgapachestrutstilesStrutsTilesListener</listenerclass>
</listener>
六修改strutsxml
<!DOCTYPE struts PUBLIC
//Apache Software Foundation//DTD Struts Configuration //EN
/dtds/strutsdtd>
<struts>
<package name=default extends=tilesdefault >
<action name=XXAction class=comXXAction>
<result name=success type=tiles >xixihaha </result>
</action>
</package>
</struts>
七创建layoutjsp注意存放路径要和tilesxml一致
<%@ taglib uri=/WEBINF/tilesjsptld prefix=tiles%>
<table>
<tr><td><tiles:insertAttribute name=header></tiles:insertAttribute></td></tr>
<tr><td><tiles:insertAttribute name=sidebar></tiles:insertAttribute></td></tr>
<tr><td><tiles:insertAttribute name=contant></tiles:insertAttribute></td></tr>
<tr><td><tiles:insertAttribute name=footer></tiles:insertAttribute></td></tr>
</table>
八创建headjspsiderbarjspcontantjspfooterjsp
九测试创建indexjsp
<form action=XXActiondo method=post>
<input type=submit/>
</form>