日期:2014-05-19  浏览次数:20763 次

struts中过滤器配置问题(高手进来)
我想让所有的MyServlet请求都经过struts2Filter过滤器,这样写会报如下错?该如何解决?
2010-11-25 09:31:53 [http-8088-2] WARN [org.apache.struts2.dispatcher.Dispatcher-49] - Could not find action or result
There is no Action mapped for namespace / and action name MyServlet. - [unknown location]
---------------------------------------
<filter>
<filter-name>struts2Filter</filter-name>
<filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2Filter</filter-name>
<url-pattern>/MyServlet</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher> 
</filter-mapping>

<servlet>
<display-name>MyServlet</display-name>
<servlet-name>MyServlet</servlet-name>
<servlet-class>
xxx.MyServlet
</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/MyServlet</url-pattern>
</servlet-mapping>

------解决方案--------------------
<url-pattern>/MyServlet/*</url-pattern>

这样行么
------解决方案--------------------
楼主是想 想让所有的MyServlet请求都经过struts2Filter过滤器

探讨
<url-pattern>/MyServlet/*</url-pattern>

这样行么

------解决方案--------------------
探讨
<filter-mapping>
<filter-name>struts2Filter</filter-name>
<url-pattern>/MyServlet</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

把<url-patt……

------解决方案--------------------
<url-pattern>/MyServlet/*</url-pattern
这个可以的