java struts2 debug

出了一堆bug 改的顺序和哪个起了作用不太记得了

下面列出遇到问题的顺序:1java.lang.NoSuchMethodException:没这个方法

代码是改正后的,出错的时候保证class ,action name, method都没拼错,找了很久,做了将package name 由default变为放action的包action中且出现此错误的时候namespace="/" 并没有,后来加的不知道会在哪个错误起作用

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>

<package name="action" namespace="/" extends="struts-default">
<action name="QUERY1" class="action.libraryaction" method="query1">
<result>/result.jsp</result>
</action>
<action name="QUERY2" class="action.libraryaction" method="query2">  
<result name="success">/result.jsp</result>
</action>  
<action name="QUERY3" class="action.libraryaction" method="query3">  
<result name="success">/result.jsp</result>
</action>  
</package>
</struts>

 Struts2 There is no Action mapped for namespace [/] and action name [xxxx] associated with context path [/xxxxx]

struts.xml自己位置飞了不在src下了,改回去好使了

 

Could not find action or result: /项目名/action名?参数=参数   这个错误是原先第一个action的result 用的大写的SUCCESS 改为小写就好了

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>

<package name="action" namespace="/" extends="struts-default">
<action name="QUERY1" class="action.libraryaction" method="query1">
<result>/result.jsp</result>
</action>
<action name="QUERY2" class="action.libraryaction" method="query2">  
<result name="success">/result.jsp</result>
</action>  
<action name="QUERY3" class="action.libraryaction" method="query3">  
<result name="success">/result.jsp</result>
</action>  
</package>
</struts>

 

posted @ 2017-05-18 23:19  不行这个名字不够霸气  阅读(244)  评论(0编辑  收藏  举报