日期:2014-05-17  浏览次数:20653 次

struts异常There is no Action mapped for namespace [/] and action name [] ......
我用的maven项目管理,这个问题是用jetty服务器出的,tomcat可以正常运行跑通。之前tomcat也出现这个问题,后来不知道不知不觉也就没这问题了,昨天换jetty容器了,问题重现,我估计还是当初配置的问题,或是什么命名空间的原因,找了半天没找到,所以求助大家。

下面是我的web.xml
	
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">
    <filter>
        <filter-name>Set Character Encoding</filter-name>
        <filter-class>com.bjhit.eranges.utils.SetCharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
           </init-param>
    </filter>
    <filter-mapping>
        <filter-name>Set Character Encoding</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>Set Character Encoding</filter-name>
        <url-pattern>*.*</url-pattern>
    </filter-mapping>
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>*.action</url-pattern>