我们可以使用struts2的titles来做页面基本布局,使得页面看起来统一一致:包括<tiles:insertAttribute name="body"/>和 <tiles:getAsString name="title"></tiles:getAsString>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<title>
<tiles:getAsString name="title"></tiles:getAsString>
</title>
</head>
<BODY>
<div id="body">
<tiles:insertAttribute name="body"/>
</div>
<div id="footer">
<div class="footcontent">
COPYRIGHTS 2012 . ALL RIGHTS RESERVED.
</div>
</div>
</BODY>
</html>
同时在配置文件titles.xml中,配置如下:
<?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="popupNullLayout" template="/_layout/popup_layout.jsp">
<put-attribute name="title" value="EQUI"/>
<put-attribute name="body" value="/body.jsp"/>
</definition>
<definition name="indexPack.index" template="/_layout/mainLayout.jsp">
<put-attribute name="title" value="TEST"/>
<put-attribute name="body" value="/_template/main/main.html"/>
</definition>
</tiles-definitions>
其中:
<put-attribute name="title" value="EQUI"/>
<put-attribute name="body" value="/body.jsp"/>
title就是我们在html页面中需要读取的<tiles:getAsString name="title"></tiles:getAsString>;例如:在<put-attribute name="title" value="EQUI"/>中将title的value值设置成“EQUI”,那么所有以这个页面为模版的页面的title就都是EQUI;
body就是html中需要插入的<tiles:insertAttribute name="body"/>;例如:使用<put-attribute name="body" value="/body.jsp"/>,即是value值设置的页面都会显示在<tiles:insertAttribute name="body"/>设定的位置上。
分享到:
相关推荐
struts结合titles的一个小例子,当备用。
第二次做关于struts的开发 受益良多~ 做的很基础 适合
The streaming service’s number of movies has decreased by more than 2,000 titles since 2010, while its number of TV shows has nearly tripled. It will be interesting to explore what all other ...
一个基于 struts1.2+spring+tomcat数据源的...布局采用struts的titles标签 数据的CRUD采用spring的JDBCTemplate 里面做了权限控制 用到了tomcat数据源(比较老的技术) 部署非常简单,里面有详细说明文档 毕设的好材料
一个漂亮,易用简单的提示框sweet-titles 鼠标落上 鼠标落下 很实用
Struts1 标签手册,5类标签库,html,nested,logic,bean,titles
通过titles的类型查询对应信息 Titles t=new Titles(); List<String> type=dao.getalltype(t); for(String types:type){ System.out.println(types); } HibernateSessionFactory.closeSession(); }
管理员登陆,采用struts titles 布局页面。可输入关键字查询学生,列出全部学生信息,增加,删除,修改,查询,分页等等,各个小功能点一应俱全。是个ssh学习的不错例子。使用tomcat 作为web服务器,sqlserver2000...
Struts Tiles标签学习PPT教学文档
Study on the Translation of English Film Titles from the Perspective of Eco-translatology.zip
大气金色粒子活动颁奖典礼文字标题片头 Awards Titles 3TJ008004
Laravel开发-titles Laravel 5.1的优雅标题生成器
本文实例为大家分享了Python Grid使用和布局的具体代码,供大家参考,具体内容如下 #!/usr/bin/env python import vtk # 这个示例主要用于将不同的图像对象显示到指定的Grid中 def main(): colors = vtk....
Oracle9i Database Documentation Titles and Part Numbes
从titles表获取按照title进行分组,每组个数大于等于2,给出title以及对应的数目t。 CREATE TABLE IF NOT EXISTS “titles” ( `emp_no` int(11) NOT NULL, `title` varchar(50) NOT NULL, `from_date` date NOT ...
CSS布局中,一个重要的标签DIV,DIV是XHTML所...注:同一个名称的id值,在当前的XHTML页面中,只日须使用一次,class名称可以重复使用.1.一列布局 一列固定宽度 XHTML CODE: 一列固定宽度width:300px;height:300px;<
安装将此行添加到您的Gemfile中: gem 'smart_titles', '~> 0.3.0'并运行: bundle install一体化在布局的<title>标记内插入head_title : <title><%= head_title "Default title" %></
On_the_Translation_of_Film_Titles.doc
table2word(titles,m) table2word(titles,m,table_title) table2word(titles,m,style) table2word(titles,m,style,table_title) table2word(titles,m,filename) table2word(titles,m,filename,table_title) table2...
by Using Account Titles in China我国会计要素的简单核算.pptx