首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

警告: Could not find action or result 什么原因?该如何解决

2012-10-06 
警告: Could not find action or result 什么原因?2012-9-23 14:58:11 com.opensymphony.xwork2.util.logg

警告: Could not find action or result 什么原因?
2012-9-23 14:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
警告: Could not find action or result
There is no Action mapped for namespace [/] and action name [login] associated with context path [/struts2]. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)


>>>>>>>>>>>>>>>>>>>>>>struts2.xml>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<package name="struts2" extends="struts-default">
<action name="login" class="zhengjianbo.LoginAction">
<resultname="success">/result.jsp</result>
</action>

</package>
>>>>>>>>>>>>>>>>>>web.xml>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<web-app version="2.5" 
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_2_5.xsd">
  
  <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>
  
</web-app>
>>>>>>>>>>>>>>>>>>>>login.jsp>>>>>>>>>>>>>>>
<form action="login" >
  username:<input type="text" name="username"><br>
  password:<input type="password" name="password"><br>
  <input type="submit" value="submit">
   
   
  </form>
>>>>>>>>>>>>>>>>>result.jsp>>>>>>>>>>>>>>
<body>
 
username:${requestScope.username }<br>
password:${requestScope.password }

</body>
 


[解决办法]

探讨

加上这个试试
<package name="struts2" extends="struts-default" namespace="/">

[解决办法]
<form action="login.action" >
username:<input type="text" name="username"><br>
password:<input type="password" name="password"><br>
<input type="submit" value="submit">
 
 
</form>
表单方法应该是这么写的。
[解决办法]
探讨

引用:

引用:

加上这个试试
<package name="struts2" extends="struts-default" namespace="/">


如果这样不行那就:
struts.xml


<package name="struts2" extends="struts-default" namespace="/">
lo……


[解决办法]

我就光看前面的cannot find action or result了、

There is no Action mapped for namespace [/] and action name [login] associated with context path [/struts2]. - [unknown location]

所以你试着把你写的struts2.xml 加入到web.xml里就应该可以了、

热点排行