严重: Could notfind action or result
There is no Action mapped for namespace / and action name login. - [unknownlocation]
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:494)
说一下可能出现的情况啊
1.-----首先查看你的struts.xml 文件是否在src目录下;
2.-----检查struts.xml文件的语法是否正确:如果1正确的话那就一定是struts.xml文件的问题: <?
xml version="1.0"encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="struts2" extends="struts-default">
<action name="login"class="com.test.action.LoginAction">
<result name="success">/result.jsp</result>
</action>
</package>
</struts>
查看你是否吧struts-default中间的“-”错写成了struts=default;
3.确定名称是 struts.xml
4.粗心,仔细检查配置文件,和excute方法的代码
说到底还是配置文件出了问题,一般应该是这样的,一定要细心查看。
不过有点朋友可能就是没有错,但是还是报这个错,那还有一种办法,就是clean项目然后重新部署重新
启动tomcate,实在不行重启myeclipse,如果不行就是上面的原因,应该就这两种。