1. My original configuration
jsp form submission path
<form class="layui-form" id="form" action="${ctx }/membersLogin/membersLoginAction!membersLogin.action"> ............ </form>
struts2 interceptor configuration
<package name="default" extends="struts-default" namespace="/membersLogin" strict-method-invocation="false"> <action name="membersLoginAction" class="seventykg.web.MembersLoginAction"> <result name="login_success">/index.jsp</result> <result name="login_fail">/login_fail.jsp</result> </action> </package>
2. Common sense is not the problem
But each time the form is submitted being given as follows:
There is no Action mapped for namespace。。。。。。。。。
3. Baidu search a bit all sorts of solutions, not what I want, but unfortunately looked struts.xml own configuration file, found that there is a place called:
<! - whether to enable dynamic method invocation -> <Constant name = "struts.enable.DynamicMethodInvocation" value = "to true" />
When this value = "false" when it is not supported ( $ {} /membersLogin/membersLoginAction!membersLogin.action CTX ) with this method ( membersLogin path), only the support ( $ {} CTX / membersLogin / membersLoginAction ) this method then need to write to the configuration file
<package name="default" extends="struts-default" namespace="/membersLogin" strict-method-invocation="false"> <action name="membersLoginAction" class="membersLoginAction" method="membersLogin"> <result name="login_success">/index.jsp</result> <result name="login_fail">/login_fail.jsp</result> </action> </package>
Into true problems can be solved
=====================================================================================
Today's special is to add this unusual problem:
In the same struts configuration file, name attribute package labels can not be all default, if more than one, it is necessary to name a name, if not or will report this exception:
There is no Action mapped for namespace [/membersLogin] and action name [membersLoginAction] associated with context path...
=========================================================================
Supplementary again
If the problem is still there
You can see if your name wrong struts.xml