sitemesh struts2 整合
来源:互联网 发布:java redis使用 编辑:程序博客网 时间:2024/05/22 14:14
在项目中导入 sitemesh jar 包 和 struts jar 包
web.xml 配置 如下:
<filter> <filter-name>sitemesh3</filter-name> <filter-class>org.sitemesh.config.ConfigurableSiteMeshFilter</filter-class> </filter> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>sitemesh3</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> <!--<dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> --></filter-mapping>
sitemesh3 配置 如下:
<sitemesh> <mapping path="/*" decorator="/decorator.jsp"/></sitemesh>
在项目根目录下 新建 decorator.jsp 内容 如下:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%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><sitemesh:write property='title'></sitemesh:write></title> <sitemesh:write property='head'></sitemesh:write> </head> <body> <sitemesh:write property='body'></sitemesh:write>
下面这些都是页面底部额外添加的内容,更多页面标签定义见官方文档。
<div class='disclaimer'>Site disclaimer. This is an example.</div> <div class='navigation'> <b>Examples:</b> [<a href="./">Static example</a>] [<a href="demo.jsp">Dynamic example</a>] </div> </body></html>
0 0
- struts2 整合 SiteMesh
- Struts2整合SiteMesh
- sitemesh struts2 整合
- struts2之整合sitemesh(sitemesh配置)
- struts2之整合sitemesh(使用sitemesh插件)
- struts2+spring2+hibernate3整合SiteMesh
- struts2之整合sitemesh(简介)
- 整合SiteMesh 之 20.3 整合Struts2与SiteMesh
- Struts2、Hibernate3、Spring2、Sitemesh、FreeMarker整合
- Struts2、Sitemesh、FreeMarker 最新版本整合配置
- struts2+sitemesh
- Struts2、FreeMarker、Sitemesh整合表现层的学习笔记
- struts2之整合sitemesh(定义装饰器页面)
- struts2之整合sitemesh(更复杂的装饰器页面)
- struts2.2.1关于sitemesh和freemarker整合的细节
- ssh整合SiteMesh
- SSH2整合SiteMesh项目
- 整合SiteMesh 之 20.2 单独使用SiteMesh
- Linux下安装*.bin/*.sh格式文件
- uva10391Compound Words
- 手贱 + 做事不认真想想后果 == 悲剧!
- Activity生命周期
- 常用的脚本
- sitemesh struts2 整合
- POJ 1905 Expanding Rods(几何+二分)
- MySQL索引背后的数据结构及算法原理
- Stack Overflow requires external JavaScript from another domain, which is blocked or failed to load.
- 前滚&后滚
- What is the difference between #import and #include in Objective-C?
- JavaScript中数组高级编程实践-2
- Ruby on Rails Tutorial 学习笔记 --第八章 登录和退出
- android分享多张图片在ContentResolver.insert返回null时的解决方案