当前位置: 代码迷 >> Java Web开发 >> ERROR org.apache.struts2.dispatcher.Dispatcher Could not find action or result解决方法
  详细解决方案

ERROR org.apache.struts2.dispatcher.Dispatcher Could not find action or result解决方法

热度:482   发布时间:2016-04-17 00:12:27.0
ERROR org.apache.struts2.dispatcher.Dispatcher Could not find action or result
2011-09-19 17:03:49,348 ERROR (org.apache.struts2.dispatcher.Dispatcher:515) - Could not find action or result
There is no Action mapped for namespace / and action name login. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:497)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
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:852)
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(Unknown Source)
下面是struts2的配置文件
<struts>
  <package name="default" extends="struts-default" >  
<action name="login.action" class="com.test.web.action.LoginAction">
<result name="input">/login.jsp</result>
  <result name="success">/WEB-INF/jsp/list.jsp</result>
  </action>
 </package>  
</struts> 
下面是web的配置文件
<context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/classes/applicationContext.xml</param-value>
  </context-param>
  <listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <filter>
  <filter-name>struts2</filter-name>
  <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
  </filter>
  <filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>
  </filter-mapping>
  <welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
下面是登录的JSP
<body>
<center><h3>请输入用户名和密码来登陆</h3>
<s:form action="login.action" method="POST">
<s:textfield name="username" label="用户名"/>
<s:textfield name="password" label="密码"/>
<s:submit value="登陆"/>
  </s:form>
</body>

很郁闷就是找不到错出现在哪里,有哪位大虾能看出来



------解决方案--------------------
<result name="input">/login.jsp</result>
<result name="success">/jsp/list.jsp</result>

试试。
------解决方案--------------------
<action name="login.action" class="com.test.web.action.LoginAction">
  相关解决方案