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

关于struts2的基础错误,我是个小菜,实在找不出来原因了,求帮忙
struts.xml
[code=java<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="com" extends="struts-default" namespace="/" >

<action name="hello.action" class="com.HelloAction">
<result name="success">/hello.jsp</result>
</action>
</package>
</struts>
[/code]

放在src目录下的.

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 
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_3_0.xsd">
  <display-name></display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
<filter>
        <filter-name>struts2Filter</filter-name>
        <filter-class>
         org.apache.struts2.dispatcher.FilterDispatcher
        </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2Filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>


错误信息:No configuration found for the specified action: 'hello.action' in namespace: ''. Form action defaulting to 'action' attribute's literal value


无论怎么样改,最后都是找不到action下的文件.
因为刚学struts,所以很多东西都弄不明白,希望能帮帮我.
struts action java

------解决方案--------------------
<filter-class>
            org.apache.struts2.dispatcher.FilterDispatcher//前面有空格
        </filter-class>
------解决方案--------------------
name="hello.action"改成name="hello"试试?
------解决方案--------------------
<filter-class>
            org.apache.struts2.dispatcher.FilterDispatcher
        </filter-class>

不要换行回车
------解决方案--------------------
引用:
name="hello.action"改成name="hello"试试?


+1
------解决方案--------------------
name="hello.action"中的“.”去掉,或者换个不带"."的名字
------解决方案--------------------
<action name="hello.action" class="com.HelloAction">
把这里改了 
<action name="hello" class="com.HelloAction">
在配置文件怎么可以把action name属性里加.呢?
------解决方案--------------------