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

struts2自定义struts.xml的位置,结果找不到action
web.xml
 
XML code
<filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        <init-param>   
              <param-name>filterConfig</param-name>   
              <param-value>/WEB-INF/conf/*.web.xml</param-value>   
          </init-param>
    </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>


ise.index.web.xml
XML code
<struts>
    <package name="userBean" extends="struts-default" namespace="/userBean">
        <action name="userAction" class="com.wolf.ise.index.timer.MyAction">
            <result name="success">/user.jsp</result>
        </action>
    </package>
</struts>


异常:
2012-1-13 16:42:21 org.directwebremoting.impl.StartupUtil logStartup
信息: Starting: DwrServlet v3.0.0-RC2-final-312 on Apache Tomcat/6.0.32 / JDK 1.5.0_21 from Sun Microsystems Inc. at /ise
2012-1-13 16:42:27 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
警告: Could not find action or result
There is no Action mapped for action name userAction. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:475)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:595)

如何解决以上问题,谢谢!

------解决方案--------------------
看看你的访问路径是什么
------解决方案--------------------
http://topic.csdn.net/u/20090515/16/92093093-f319-4897-863d-c98775cc3c5b.html
这里有人已经做过这种实验了
------解决方案--------------------
<package name="ise" extends="struts-default" namespace="/userBean">
怎么在linux下安装jdk和tomcat