我认为 tiles没有啥优点,希望高手指教。

解决方案 »

  1.   

    可我觉得用<iframe>也能实现这些呀,这也能方便的改变布局,只需改变一个文件见能改变整个系统的布局,
      

  2.   

    是,如果你主页面里放了N个<iframe>的,你能够用一个xxx.xml配置文件组装和重新配置吗
      

  3.   

    布局文件
    <%@ page language="java" pageEncoding="UTF-8"%><%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html:html locale="true">
      <head>
        <html:base />
        
        <title>招聘信息查询</title>
        <link href="zpxx.css" type="text/css" rel="stylesheet" />
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
      </head>
      
      <body>
        <table width="760" border="0" align="center" cellspacing="0" cellpadding="0">
        <!--网站logo -->
        <tr><td colspan="3"><tiles:insert attribute="header"/></td></tr>
        <!--页面上面的导航链接 -->
        <tr><td colspan="3"><tiles:insert attribute="top"/></td></tr>
        <tr>    
        <td width="162" valign="top">
        <div><tiles:insert attribute="ad1"/></div>
        <!--左侧的行业或者专业 -->
        <div><tiles:insert attribute="left"/></div>
        <div><tiles:insert attribute="ad2"/></div>
        </td>
        <td width="6"></td>
        <!--显示招聘信息 -->
        <td width="592" valign="top">
        <div>
          <!--当前位置 20-->
          <div><tiles:insert attribute="position"/></div>
          <!--flash1 85-->
          <div><tiles:insert attribute="flash1"/></div>
          <!--数据 430-->
          <div><tiles:insert attribute="vocation"/></div>
          <!--flash2 85-->
          <div><tiles:insert attribute="flash2"/></div>
        </div>
        </td>
        </tr>
        <!--版权信息 -->
        <tr><td colspan="3"><tiles:insert attribute="footer"/></td></tr>
        </table>
      </body>
    </html:html>这是配置文件<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN" "tiles-config_1_1.dtd" >
    <tiles-definitions>
      <definition name="zpxx001" path="/zpxx/layout.jsp">
      <put name="header" value="/zpxx/header.jsp"/>
      <put name="top" value="/zpxx/menutop.jsp"/>
      <put name="ad1" value="/zpxx/adtop.jsp"/>
      <put name="left" value="/zpxx/menuleft.jsp"/>
      <put name="ad2" value="/zpxx/adbottom.jsp"/>
      <put name="position" value="/zpxx/currentlay.jsp"/>
      <put name="flash1" value="/zpxx/flash.jsp"/>
      <put name="flash2" value="/zpxx/flash.jsp"/>  
      <put name="vocation" value="/zpxx/content.jsp"/>
      <put name="footer" value="/include/foot.html"/>
      </definition>
      <definition name="zpxx002" path="/zpxx/layout.jsp">
      <put name="header" value="/zpxx/header.jsp"/>
      <put name="top" value="/zpxx/menutop.jsp"/>
      <put name="left" value="/zpxx/menuleft.jsp"/>
      <put name="main" value="/zpxx/content.jsp"/>
      <put name="footer" value="/include/foot.html"/>
      </definition>
    </tiles-definitions>如果想改页面的某个部分,可以直接修改对应位置的文件;如果想改布局,直接改布局文件,还可以替换部分页面;另外还可以创建N多模板可以使用