[color=green]myeclipse6.5+struts2-core-2.1.8.jar+urlrewrite-3.2.0.jar如果存在开发环境的问题,那么自己先建立一个项目,把相应的文件导入即可[/color]
[color=red]1.注意:为了实现action访问的伪静态在web.xml中配置struts2和urlrewrite时,加上[/color]
[color=red]2.注意:匹配字符串的时候或者每一个参数的时候都需要用小括号括起来
[/color]
[color=green]就上面这个两个小问题,让我在使用UrlRewrite的时候折磨惨咯!带血的经验啊![/color]
.
[color=red]1.注意:为了实现action访问的伪静态在web.xml中配置struts2和urlrewrite时,加上[/color]
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<!-- url重写的过滤器 -->
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
</filter-class>
<init-param>
<param-name>confReloadCheckInterval</param-name>
<param-value>20</param-value>
</init-param>
<init-param>
<param-name>logLevel</param-name>
<param-value>WARN</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<!-- struts2过滤器 -->
<filter>
<filter-name>struts2-execute</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2-execute</filter-name>
<url-pattern>*.action</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
[color=red]2.注意:匹配字符串的时候或者每一个参数的时候都需要用小括号括起来
[/color]
<!-- 点击footer链接去对应的footerPage页面 -->
<rule>
<from>^/footer/([\w\s*]+)$</from>
<to>/member/pages!toFooterPage.action?name=$1</to>
</rule>
<outbound-rule>
<from>member/pages!toFooterPage.action\?name=([\w\s*]+)$</from>
<to>/footer/$1</to>
</outbound-rule>
[color=green]就上面这个两个小问题,让我在使用UrlRewrite的时候折磨惨咯!带血的经验啊![/color]
.