struts2的Tiles管理页面
来源:互联网 发布:java 必须加final 编辑:程序博客网 时间:2024/05/16 18:32
Tiles的好处此处不多说了,网上有很多,此处直接上代码:
1.在pom.xml文件中添加对Tiles的依赖
<!-- struts2的tiles依赖 --> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-tiles-plugin</artifactId> <version>2.3.16.1</version> </dependency> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-extras</artifactId> <version>3.0.5</version> </dependency>
2.在web.xml文件中配置Tiles的Listener
<listener> <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class> </listener>3.新建baseLayout.jsp页面, 作为基本布局页
<!DOCTYPE html><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><!-- 配置tiles标签 --><%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %><html lang="en"><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>测试tiles</title></head><body>hello<br/><tiles:insertAttribute name="header"/><tiles:insertAttribute name="menu"/><tiles:insertAttribute name="content"/><tiles:insertAttribute name="bottom"/></body></html>
4.在WEB-INF目录下新建tiles.xml文件, 是tiles的默认配置文件
文档内容如下:
<?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="base" template="/employee/baselayout.jsp"> <put-attribute name="header" value="/employee/header.jsp" /> <put-attribute name="menu" value="/employee/menu.jsp" /> <put-attribute name="content" value="" /> <put-attribute name="bottom" value="/employee/bottom.jsp" /> </definition> <!-- index页面 --> <definition name="index" extends="base"> <put-attribute name="content" value="/employee/indexcontent.jsp" /> </definition></tiles-definitions>
5.配置action,package要继承tiles-default
<package name="demo" extends="struts-default,tiles-default"> <!-- 返回值类型 --> <result-types> <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" /> </result-types> <action name="demo" class="com.lubansoft.attendance.action.employee.TestAction"> <result name="success">employee/index.jsp</result> </action></package>
0 0
- struts2的Tiles管理页面
- Struts2的 Tiles 配置步骤
- Tiles与siteMesh页面布局管理
- struts布局管理---SiteMesh一个优于Apache Tiles的Web页面布局、装饰框架
- Struts2 中的Tiles框架的使用
- Struts2学习之旅二 tiles布局和权限管理
- Tiles框架 页面排版方面的框架
- struts2+tiles配置
- struts2+tiles 配置
- struts2+tiles环境搭建
- struts2整合tiles
- struts2+tiles环境搭建
- Struts2和Tiles集成
- 关于Struts2.1.6的tiles的无法工作的问题
- struts2.0 整合tiles 1配置(转载后的修改)
- struts2 tiles 模块异常 花费了我一天的时间
- Struts2 整合Tiles出现的I/O Error Reading问题
- Tiles 下面的某个页面跳转时会报错
- sqlite数据库的char,varchar,text,nchar,nvarchar,ntext的区别
- 用真机调试时出现了“Your build settings specify a provisioning profile with the UUID “”, however, no such prov
- Leetcode (3) Longest Substring Without Repeating Characters 解题报告
- git 忽略特殊文件
- 如何把word转换成pdf的形式
- struts2的Tiles管理页面
- 页面加载过程中的加载动画效果
- java线程池和队列分析
- 在网页中添加 “返回顶部”按钮
- java基础
- 内存配置参数的含义 JDK和MyEclipse
- 日历插件
- IOS--错误集锦--reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
- Java类的加载及初始化顺序