在Struts中使用Tiles简明手册
来源:互联网 发布:unity3d用的什么语言 编辑:程序博客网 时间:2024/05/01 04:09
如果要在Struts中使用tiles,首先要保证页面可以正确引入struts-tiles.tld,即<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>。另外在struts-config.xml配置如下:
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<!-- Path to XML definition file -->
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
<!-- Set Module-awareness to true -->
<set-property property="moduleAware" value="true" />
</plug-in>
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
在
//定义一个母板
<definition name=".mainLayout" path="/common/layouts/classicLayout.jsp">
<put name="title" value="Sample Page Title" />
<put name="header" value="/common/header.jsp" />
<!--put name="menu" value=".mainMenu" /-->
<put name="footer" value="/common/footer.jsp" />
<put name="body" value="" />
</definition>
在classicLayout.jsp文件中如下:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!--%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %-->
<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>
<html>
<head><title>Simple jsp page</title></head>
<body bgcolor="#ffffff" text="#000000" link="#023264" alink="#023264" vlink="#023264">
<table border="0" width="100%" cellspacing="5">
<tr>
<td colspan="2"><tiles:insert attribute="header" /></td>
</tr>
<tr>
<td width="140" valign="top">
<!--tiles:insert attribute='menu'/-->
</td>
<td valign="top" align="left">
<tiles:insert attribute='body' />
</td>
</tr>
<tr>
<td colspan="2">
<tiles:insert attribute="footer" />
</td>
</tr>
</table>
</body>
</html>
//定义子板,其通过extends继承母板
<definition name="ordertiles" extends=".mainLayout">
<put name="body" value="/pages/order.jsp" />
</definition>
//定义一个action,它是指向tiles模板的。
<action path="/ordertiles" type="org.apache.struts.actions.ForwardAction" parameter="ordertiles"></action>
//定义一个action,其forward path为一个包含tiles模板的action
<action path="/editOrder" type="heroking.action.EditOrder"
name="OrderForm" scope="request"
validate="false">
<forward name="success" path="/ordertiles.do"/>
</action>
<action path="/submitOrder" type="heroking.action.SubmitOrder"
name="OrderForm" scope="request"
validate="false">
<forward name="success" path="/ordertiles.do"/>
</action>
即可。
- 在Struts中使用Tiles简明手册
- 在Struts中使用Tiles简明手册
- Struts中使用tiles
- Struts中tiles的使用
- struts中使用tiles组件
- struts中使用tiles组件 更新中。。。
- 在struts里面使用Tiles框架
- struts中使用tiles组件(原创)
- Struts框架中 's Tiles使用入门教程
- Struts tiles使用中遇到的问题
- freemarker在tiles中使用
- Struts 框架-----使用 Tiles
- Struts Tiles框架使用
- Struts Tiles框架使用
- struts-tiles 使用介绍
- Struts Tiles框架使用
- Struts Tiles框架使用
- struts中tiles使用中出现空指尖的问题
- 管理感悟:心态篇
- 管理感悟:修炼篇
- js FAQ
- 总经理、总裁、总监、首席执行官,谁最了不起?
- 第三章控制程序流程(Controlling Program Flow)
- 在Struts中使用Tiles简明手册
- 你 --- 短诗四句
- mantis 0.18 or 0.19 升级到1.0.0Rcx 升级不成功,的解决方法
- 国内十大破解论坛
- Create a C# COM and transfer event
- 利用Java编写手机应用程序PalmOS基础篇
- Custom Web Control [一]
- 什么是J2ME及其基本慨念
- 手机游戏趋势和相关J2ME APIs