java.lang.NoSuchMethodException:com.yxq.action.AdminAction.addGoods ()
In learning struts2 Sometimes this anomaly occurs, it is summarized as follows, easy to refer to:
First try to see if the other methods can be used, if this is the case, perhaps your action class did not inherit the structs inside the dispatchaction or other classes. And you notice the parameter list of the method, the type order is correct, is in the following order: actionmapping mapping,actionform form, httpservletrequest request, HttpServletResponse response
2. The action class method is defined as the private type. The method that is accessed in the action below is defined as a private type. The program throws the above exception when it accesses its methods.
3, in fact, java.lang.NoSuchMethodException the root cause of this anomaly has two:
(1), missing some jar files;
(2), some jar files are duplicated.
4, the use of STRUTS2 framework problems
In the page using jquery Ajax call action in the Vailduname method, error, said my method does not exist. But the reality is there. public string Vailduname (String loginName) throwsexception{}
The problem is that in this parameter, there is no parameter in the Struts2 (struts2 is the method to execute the action through the reflection mechanism, the STRUTS2 specification is that the action method is not required, the method with parameters and the method without parameters is two different methods , so there will be a situation that cannot be found )
Workaround:
Private String LoginName;
Public String Vailduname () throws exception{}
Getter and setter methods for LoginName
That's when you use Ajax calls.
5, Java.lang.NoSuchMethodException This exception refers to your action does not have this method, indicating that you have found the action but did not find the method, so there are 2 cases,
1th situation: You are not submitted to this action, check the configuration file, there is no same path
2nd situation: There is no such method in your action
Java.lang.NoSuchMethodException:com.yxq.action.AdminAction.addGoods () "Reprint"