JR 精品文章 - struts的tiles框架应用的一些体会
AD: jr (at) javaresearch.org


首页 | 动态 | 文章 | FAQ  | 新闻 | 下载 | 代码 | 工作 | 调查 | 术语 | 站点 | 图书 | 论坛 | 帮助 | 全部  

TOP | 交流 | 软件 | 专栏 | 开源 | 译/著 | 源码 | API  | 推荐 | FTP  | 积分 | 统计 | 搜索 | Blog | 我们  
首页 » 研究文集 » 开发框架 搜索标题相关文章 搜索标题相关文章    评论此文章 发表评论     开始监控此文章 开始监控   加入收藏夹  加入收藏夹
struts的tiles框架应用的一些体会
yirancn 原创   更新:2007-10-30 22:40:07  版本: 1.0   

1.在struts-config.xml中插入下文件:

<plug-in className="org.apache.struts.tiles.TilesPlugin">
   <set-property   property="definitions-config"   value="/WEB-INF/tiles-defs.xml"/> 
    <set-property   property="moduleAware" value="false"/>  
  </plug-in>
2.web.xml文件加入标签库的应用:
<jsp-config>
  <taglib>
     <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
     <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
  </taglib>
  </jsp-config>  
3.在页面上使用<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>引入tiles标签。
4.定义tiles-defs.xml文件:
<?xml   version="1.0"   encoding="UTF-8"?>   
<!DOCTYPE   tiles-definitions   PUBLIC   "-//Apache   Software   Foundation//DTD   Tiles   Configuration   1.1//EN"   "http://jakarta.apache.org/struts/dtds/tiles-

config_1_1.dtd">   
  <tiles-definitions>   
        <definition     name="index-definition"     path="/MyJsp2.jsp">                               
        </definition>                
  </tiles-definitions>  
5.编写页面框架:
<%@ page language="java" pageEncoding="GB2312"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title><tiles:getAsString name="title"/></title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">


  </head>
  
  <body  text="#333333" bgcolor="#ffffff" leftmargin="2" topmargin="2"marginwidth="0" marginheight="0">
  <div align="center">
    <tiles:insert attribute="top" />
    <table border="0" width="100%" height="90%" cellspacing="0" cellpadding="0">
       <tr> 
          <td width="15%" height="80%" valign="top" align="left" >
            <tiles:insert attribute="left" />
          </td>         
          <td width="85%" align="center" height="50%" valign="top">
             <tiles:insert attribute="body"/>
          </td>
          </tr>
     </table>
     <tiles:insert attribute="bottom"/>                         
  </div>   
  </body>
</html>

6。在web.xml配置<welcome-file-list>为包含以下内容的jsp页面welcome.jsp:
<tiles:insert definition="baseinfo_template" flush="true"/>



版权声明   给作者写信
本篇文章对您是否有帮助?  投票:         投票结果:     10       1
作者其它文章: 作者全部文章
评论人:jacky_zz 发表时间: Wed Oct 31 18:16:32 CST 2007
不错,适合初学者。
评论人:wxylwy 发表时间: Tue Nov 06 14:48:59 CST 2007
很 不错的东东

这个文章共有 2 条评论
主题: Hibernate事务处理机制 上一篇文章
返回文章列表 返回〔开发框架〕
下一篇文章 主题: Spring学习心得


文字广告链接
        自主、快速定制基于JAVA的B/S业务系统          重量级企业在线自定义WEB报表平台
        Excel制表、零代码发布、打印、图表结合——快逸报表,免费、稳定、功能强大的java工具
        技术圈: 关于Java、dotNet、PHP、Ruby、奇客、Web2.0等更多资讯博客精选文章

关于 JR  |  版权声明  |  联系我们 

©2002-2006 JR 版权所有 沪ICP备05019622号