锘??xml version="1.0" encoding="utf-8" standalone="yes"?>成人影院在线,亚洲国产高清aⅴ视频,亚洲免费在线视频一区 二区http://www.aygfsteel.com/javaocean/category/45361.htmlzh-cnFri, 18 Jun 2010 01:29:57 GMTFri, 18 Jun 2010 01:29:57 GMT60Struts2.1 Tiles 鎻掍歡閰嶇疆瀹炰緥http://www.aygfsteel.com/javaocean/articles/321886.htmljavaoceanjavaoceanWed, 26 May 2010 05:55:00 GMThttp://www.aygfsteel.com/javaocean/articles/321886.htmlhttp://www.aygfsteel.com/javaocean/comments/321886.htmlhttp://www.aygfsteel.com/javaocean/articles/321886.html#Feedback0http://www.aygfsteel.com/javaocean/comments/commentRss/321886.htmlhttp://www.aygfsteel.com/javaocean/services/trackbacks/321886.html寮鍙戠幆澧冿細JDK6錛孧yEclipse8.0GA, Tomcat6.0銆?br /> 欏甸潰璁捐錛?br />
1.鏂板緩web宸ョ▼tilesdemo銆傚彸閿偣鍑婚」鐩悕縐?gt;MyEclipse>澧炲姞Strusts2鏀寔錛岄変腑Struts2鏍稿績搴撳拰Tiles鎻掍歡搴撱?nbsp;

2.鍦╳eb.xml涓厤緗洃鍚櫒鍔犺澆Tiles鎻掍歡銆?br />
3. 鏍規嵁璁捐鍦?WEB-INF/common/涓嬫柊寤哄洓涓狫SP欏甸潰銆?br />
header.jsp 浠h〃欏靛ご錛?br /> body.jsp浠h〃欏甸潰涓諱綋錛?br /> footer.jsp浠h〃欏佃剼閮ㄥ垎錛?br /> simpleTpl.jsp鏄牴鎹墠闈㈢殑璁捐灝嗛〉闈㈡爣棰樺拰涓婇潰鍑犱釜欏甸潰鎸変笂銆佷腑銆佷笅緇勮璧鋒潵鐨勭畝鍗曟ā鐗堥〉闈€?br />
4. 鍦╓EB-INF涓嬫柊寤簍iles.xml錛岀紪鍐欎竴涓畝鍗曠殑妯$増simpleTpl, 鍚屾椂緙栧啓涓涓欏電戶鎵縮impleTpl錛屼笉鍚屼箣澶勪粎浠呮槸鏍囬銆?br /> tiles.xml浠g爜

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN" "http://tiles.apache.org/dtds/tiles-config_2_0.dtd" >
<tiles-definitions>
  
<definition name="simpleTpl" template="/WEB-INF/jsp/common/simpleTpl.jsp">
      
<put-attribute name="title" value="綆鏄撴ā鐗?></put-attribute>
      
<put-attribute name="header" value="/WEB-INF/jsp/common/header.jsp"></put-attribute>
      
<put-attribute name="body" value="/WEB-INF/jsp/common/body.jsp"></put-attribute>
      
<put-attribute name="footer" value="/WEB-INF/jsp/common/footer.jsp"></put-attribute>
  
</definition>
  
  
<definition name="index" extends="simpleTpl" >
      
<put-attribute name="title" value="浜掕仈鍔涢噺棣栭〉"></put-attribute>
  
</definition>
</tiles-definitions>

5.緙栬緫simpleTpl.jsp,灝嗗畾涔夊ソ鐨則ile鏀懼叆妯$増鐨勫搴斾綅緗傝繖閲岃鐢ㄥ埌tiles鐨凧SP鏍囪銆備嬌鐢ㄦ爣璁伴渶瑕佷嬌鐢╰aglib鎸囦護瀵煎叆鏍囪搴撳埌欏甸潰錛岄渶瑕佸~鍐檖refix 鍜?uri錛岃繖涓や釜灞炴х殑鍊間粠瀵瑰簲tld鏂囦歡涓殑short-name鍜寀ri鏍囪鐨勫鹼紝璇ユ枃浠剁殑浣嶇疆瑙佷笅鍥俱?br />

simpleTpl.jsp浠g爜
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="tiles"  uri="http://tiles.apache.org/tags-tiles"%>
<%
String 
path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  
<head>
    
<base href="<%=basePath%>">
    
    
<title>
      
<tiles:getAsString name="title"></tiles:getAsString>
    
</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>
    
<tiles:insertAttribute name="header"></tiles:insertAttribute>
    
<tiles:insertAttribute name="body"></tiles:insertAttribute>
    
<tiles:insertAttribute name="footer"></tiles:insertAttribute>
  
</body>
</html>
6.緙栬緫struts.xml銆傝鐗瑰埆娉ㄦ剰緇ф壙鐨勭埗鍖呮槸tiles-default錛宺esult鐨勭被鍨嬫槸tiles銆?br /> strust.xml浠g爜
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
    
<include file="struts-default.xml"></include>
    
<package name="tielsDemo" namespace="/" extends="tiles-default">
      
<action name="index">
        
<result type="tiles">index</result>
      
</action>
    
</package>
</struts>    
7.鍙戝竷鍒癟omcat錛屽惎鍔ㄣ傚湴鍧鏍忚緭鍏?a href="http://localhost:8080/tilesDemo/index.action">http://localhost:8080/tilesDemo/index.action嫻嬭瘯銆?br /> 嫻忚鍣ㄦ樉紺虹粨鏋滐細





javaocean 2010-05-26 13:55 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 万安县| 休宁县| 正安县| 周至县| 莱西市| 那坡县| 宁城县| 桂东县| 鸡泽县| 兴国县| 上思县| 连山| 阜南县| 枣庄市| 乌兰县| 清水县| 临潭县| 江口县| 桃江县| 沈丘县| 阿鲁科尔沁旗| 墨江| 南华县| 德化县| 商南县| 山阳县| 上犹县| 城步| 文登市| 鄂伦春自治旗| 西吉县| 东山县| 四川省| 兰西县| 寻乌县| 获嘉县| 彰化市| 海兴县| 扶余县| 昌图县| 绥棱县|