用ext做的form,如果在struts2的action配置了method="",可以正确找到method。
如果是动态方法调用的话就找不到。请教各位大侠! form的提交地址:
url:'http://127.0.0.1:8080/pm/staff/staff1.action!add',
struts2.xml: <package name="staff" extends="json-default" namespace="/staff" >
<action name="staff1" class="com.software.action.staffAction" method="add" >
<result name="hehe">/page/aa.html</result>
</action>
<!-- 不匹配任何action定义时,显示没有action的信息 -->
<action name="*">
<result>/page/noaction.html</result>
</action>
</package>
如果是动态方法调用的话就找不到。请教各位大侠! form的提交地址:
url:'http://127.0.0.1:8080/pm/staff/staff1.action!add',
struts2.xml: <package name="staff" extends="json-default" namespace="/staff" >
<action name="staff1" class="com.software.action.staffAction" method="add" >
<result name="hehe">/page/aa.html</result>
</action>
<!-- 不匹配任何action定义时,显示没有action的信息 -->
<action name="*">
<result>/page/noaction.html</result>
</action>
</package>
<action name="staff1" class="com.software.action.staffAction" >
<result name="hehe">/page/aa.html</result>
</action>
<!-- 不匹配任何action定义时,显示没有action的信息 -->
<action name="*">
<result>/page/noaction.html</result>
</action>
</package>
和我原来的写法报的是一个错: result defined for action com.software.action.staffAction and result success
终于看出来了url:'http://127.0.0.1:8080/pm/staff/staff1!add.action',add 位置不对 以及 !中英文还有<action name="staff1" class="com.software.action.staffAction" method="add" > method="add"
去掉
<a href="/login!checkValid.action">验证</a>好久没用这种方法确实是忘记了
你去查下
Struts2 动态方法调用 就有介绍了