java urlrewrite
来源:互联网 发布:2016淘宝类目销量排名 编辑:程序博客网 时间:2024/06/05 02:46
加入urlrewrite-3.2.0.jar包
在web.xml中加入
<filter> <filter-name>UrlRewriteFilter</filter-name> <filter-class> org.tuckey.web.filters.urlrewrite.UrlRewriteFilter </filter-class> <init-param> <param-name>logLevel</param-name> <param-value>WARN</param-value> </init-param> </filter>
<filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern><dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher></filter-mapping>
<filter-mapping> <filter-name>UrlRewriteFilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping>
再在WEB-INFO下加入urlrewrite.xml
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN" "http://tuckey.org/res/dtds/urlrewrite3.2.dtd"><urlrewrite use-query-string="true"> <!-- <rule> <from>^/index.html$</from> <to>/index.action</to> </rule> <outbound-rule> <from>/index.action</from> <to>/index.html</to> </outbound-rule> --> <rule> <from>^/bbs$</from> <to>/showMainModule.action</to> </rule> <outbound-rule> <from>/showMainModule.action</from> <to>/bbs</to> </outbound-rule> <!-- showModuleById.action?fmid=3 showVddetail.action\?vdid=([0-9]+) --> <rule> <from>^/bbs/board-([0-9]+)-([0-9]+)$</from> <to>/showModuleById.action?fmid=$1&pageNo=$2</to> </rule> <outbound-rule> <from>/showModuleById.action\?fmid=([0-9]+)&pageNo=([0-9]+)</from> <to>/bbs/board-$1-$2</to> </outbound-rule> <!-- 最少匹配写在最下面,因为匹配时从上往下 --> <rule> <from>^/bbs/board-([0-9]+)$</from> <to>/showModuleById.action?fmid=$1</to> </rule> <outbound-rule> <from>/showModuleById.action\?fmid=([0-9]+)</from> <to>/bbs/board-$1</to> </outbound-rule> <!-- http://localhost/club/bbs/showPostsById.action?fpid=10300# --> <rule> <from>^/bbs/posts-([0-9+])$</from> <to>/showPostsById.action?fpid=$1</to> </rule> <outbound-rule> <from>/show.do\?id=([0-9]+)&data=([0-9]+)</from> <to>/show_$1_$2.html</to> </outbound-rule> </urlrewrite>
jsp页面中:
<a href='<c:url value="/showModuleById.action?fmid=${forumModuleVo.forumModule.fmid }" />'>${forumModuleVo.forumModule.fmmname }</a>
其中,<c:url value="" /> 已经包含了上下文路径
阅读全文
0 0
- java urlrewrite
- java urlrewrite
- java urlrewrite
- java urlrewrite
- Java URLRewrite重定向
- java urlrewrite伪静态
- java urlrewrite 使用
- UrlReWrite
- urlrewrite
- UrlReWrite
- urlrewrite
- UrlRewrite
- URLRewrite
- urlrewrite
- urlrewrite
- urlrewrite
- UrlRewrite
- urlrewrite
- hdu1556Color the ball线段树区间更新
- 万恶的NULL
- @Transactional 事务回滚 分析
- OSGI-karaf安装及使用
- sql-语法
- java urlrewrite
- Spring AOP annotation 简单实例
- sql-概述
- 声明和定义的区别
- sql-经典例子练习
- Spring AOP annotation 用环绕通知写日志
- AngularJs中$http发送post或者get请求,SpringMVC后台接收不到参数值的解决办法
- android_1 环境搭建
- mysql 模板