我的一个项目现在需要做静态化处理,准备使用tuckey的UrlRewriteFilter来做URL重写实现,servlet容器是tomcat6.0,基于ssh框架,项目名称叫做test。
web.xml的配置如下<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- 配置UrlRewrite --> <filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</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</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>struts-default.xml,struts-plugin.xml,../config/struts2/struts-common.xml,
../config/struts2/struts-member1.xml,
../config/struts2/struts-member2.xml,
../config/struts2/struts-member3.xml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
urlrewrite.xml配置如下<urlrewrite>
<rule>
<from>^/test/index.html</from>
<to type="forward">test/index.jsp</to>
</rule>
</urlrewrite>
按照以上配置tomcat启动后,访问http://localhost:8080/test/或者http://localhost:8080/test/index.jsp都没有问题,能显示我需要的页面。此时urlrewrite已经配置了当请求test/index.html时,实际请求test/index.jsp。现在在地址栏输入http://localhost:8080/test/index.html时,没有转向index.jsp,显示错误404。
上面的配置有什么问题吗
还有一个问题,struts跳转我用的是动态方法调用即xxx!xxxx.action或者带参数的xxx!xxxx.action?flag='x',我想在浏览器中看到的效果是xxx_xxxx.xml?flag='x';urlrewrite.xml又应该怎么配置。
TomcatStrutsFilterHTML
web.xml的配置如下<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- 配置UrlRewrite --> <filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</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</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>struts-default.xml,struts-plugin.xml,../config/struts2/struts-common.xml,
../config/struts2/struts-member1.xml,
../config/struts2/struts-member2.xml,
../config/struts2/struts-member3.xml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
urlrewrite.xml配置如下<urlrewrite>
<rule>
<from>^/test/index.html</from>
<to type="forward">test/index.jsp</to>
</rule>
</urlrewrite>
按照以上配置tomcat启动后,访问http://localhost:8080/test/或者http://localhost:8080/test/index.jsp都没有问题,能显示我需要的页面。此时urlrewrite已经配置了当请求test/index.html时,实际请求test/index.jsp。现在在地址栏输入http://localhost:8080/test/index.html时,没有转向index.jsp,显示错误404。
上面的配置有什么问题吗
还有一个问题,struts跳转我用的是动态方法调用即xxx!xxxx.action或者带参数的xxx!xxxx.action?flag='x',我想在浏览器中看到的效果是xxx_xxxx.xml?flag='x';urlrewrite.xml又应该怎么配置。
TomcatStrutsFilterHTML
解决方案 »
- java 生成csv乱码。。。
- StringBean.jsp(31,4) The value for the useBean class attribute StringBean1 is in
- 如何省略过长的页面文本内容
- apache如何发布两个web项目啊 ??
- 关于聊天室私聊,该如何实现呢?在线急等,请各位帮忙
- 急救:通过url在不同服务器来回跳转时如何保证取到正确的session?其中一端是两个服务器虚拟成一个ip。
- 在线模块,使用什么技术吗
- JSP页面上使用Microsoft.XMLHTTP对象。第一次能取出值,第二次运行正常,但取不出值
- 强烈谴责同样问题问十七八遍的人!!!
- 关于多个系统用户中心的疑问
- spring框架中各种controller
- JSP获取不到session是怎么回事?
<rule>
<from>/test/index.html</from>
<to>/test/index.jsp</to>
</rule>
</urlrewrite>