xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>reportingsystem</display-name>
<welcome-file-list>
<welcome-file>/admin/login.jsp</welcome-file>
</welcome-file-list>
<!-- 字符过滤器 -->
<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- UrlRewriteFilter简化URL,有利于搜索引擎收录 -->
<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>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <!-- Struts2 核心过滤器 --><!--
<filter>
<filter-name>struts2-cleanup</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ActionContextCleanUp
</filter-class>
</filter>
--><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,struts.xml,struts-user.xml </param-value>
</init-param>
-->
</filter>
<filter>
<filter-name>userlogin</filter-name>
<filter-class>
com.web.filter.UrlFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>userlogin</filter-name>
<url-pattern>/admin/system/*</url-pattern>
</filter-mapping>
<!--
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
--><!--<filter-mapping>
<filter-name>struts2-cleanup</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE </dispatcher>
</filter-mapping>
-->
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<!-- spring的应用上下文 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext*.xml,/WEB-INF/daoContext.xml</param-value>
</context-param>
<!-- spring的监听器,以便在启动时就自动加载spring的配置 -->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener><!-- OpenSessionInViewFilter过滤器 -->
<filter>
<filter-name>lazyLoadingFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>lazyLoadingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
urlrewrite.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 2.6//EN"
"http://tuckey.org/res/dtds/urlrewrite2.6.dtd"><urlrewrite>
<rule>
<from>web</from>
<to type="forward" >web/index.action</to>
</rule>
</urlrewrite>
主要是完成http://localhost:7001/reportingsystem/web/index.action
变成http://localhost:7001/reportingsystem/web
以上配置可以直接过去,但是到了页面点链接跳转其他页面就出404错误There is no Action mapped for namespace /web/index.action and action name index无法定义到namespace 这页面中的方法都是定义在namespace="/web"下的
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>reportingsystem</display-name>
<welcome-file-list>
<welcome-file>/admin/login.jsp</welcome-file>
</welcome-file-list>
<!-- 字符过滤器 -->
<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- UrlRewriteFilter简化URL,有利于搜索引擎收录 -->
<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>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <!-- Struts2 核心过滤器 --><!--
<filter>
<filter-name>struts2-cleanup</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ActionContextCleanUp
</filter-class>
</filter>
--><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,struts.xml,struts-user.xml </param-value>
</init-param>
-->
</filter>
<filter>
<filter-name>userlogin</filter-name>
<filter-class>
com.web.filter.UrlFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>userlogin</filter-name>
<url-pattern>/admin/system/*</url-pattern>
</filter-mapping>
<!--
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
--><!--<filter-mapping>
<filter-name>struts2-cleanup</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE </dispatcher>
</filter-mapping>
-->
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<!-- spring的应用上下文 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext*.xml,/WEB-INF/daoContext.xml</param-value>
</context-param>
<!-- spring的监听器,以便在启动时就自动加载spring的配置 -->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener><!-- OpenSessionInViewFilter过滤器 -->
<filter>
<filter-name>lazyLoadingFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>lazyLoadingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
urlrewrite.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 2.6//EN"
"http://tuckey.org/res/dtds/urlrewrite2.6.dtd"><urlrewrite>
<rule>
<from>web</from>
<to type="forward" >web/index.action</to>
</rule>
</urlrewrite>
主要是完成http://localhost:7001/reportingsystem/web/index.action
变成http://localhost:7001/reportingsystem/web
以上配置可以直接过去,但是到了页面点链接跳转其他页面就出404错误There is no Action mapped for namespace /web/index.action and action name index无法定义到namespace 这页面中的方法都是定义在namespace="/web"下的
解决方案 »
- 学J2EE要学好jsp+servelet吗?
- Hibernate与连接池获取的连接各有什么不同?
- 在现在的JAVA项目开发中,用JPA(Java Persistence API)的多吗?或者说现在正在使用的同志们可以出来谈谈自己的使用心得!
- 求助:hibernate 多对多 多对一 多表连接查询问题。
- 200分求助--使用反射机制将ResultSet对象转换后传给jsp!
- struts数据库连接池问题
- JAVA
- 组建点石软件虚拟股份公司的公告
- 在服务器启动tomcat遇到的问题
- 如何用springmvc对表单radio chexbox select 把这些标签的数据存到数据库 而且在点击查看的数据还能回显到表单
- 怎么实现单点登录?
- 请问如何在不用struts框架,只用JSP、serverlet、java的情况下实现文件的批量下载,谢谢
应该类似如下写法:
<rule>
<from>^/(.*).html$</from>
<to>/test.do?action=$1</to>
</rule>
<to type="forward" >/web/index.action</to>开始符号和结束符号忘记了