1. Add <constant name = "struts. Enable. dynamicmethodinvocation" value = "true"/> In struts. XML to open the DMI function in struts. The call method is useraction! Add
Solve the Problem of there is no action mapped for namespace [/user] and action name [user! Add] associated with context path error.
2. Use wildcards
Use wildcards to add to favorites in the struts2 configuration file
Form 1: Call different methods in the same action
<Action name = "* Action" class = "jcuckoo. loginregistaction "method =" {1} "> <result name =" input ">/login. JSP </result> <result name = "error">/error. JSP </result>
<Result name = "success">/welcome. jsp </result> </Action>
The value of the first * in the Value Name attribute value of the expression {1.
If the requested URL is loginaction. Action, the login method in jcuckoo. loginregistaction is called. If the requested URL is registeraction. Action, the Register Method in jcuckoo. loginregistaction is called;
Form 2: Call the execute method of different actions through matching
<Action name = "* Action" class = "jcuckoo. {1} action "> <result name =" input ">/login. JSP </result> <result name = "error">/error. JSP </result>
<Result name = "success">/welcome. jsp </result> </Action>
The method attribute is not shown above, so the corresponding execute method is called by default.
If the requested URL is loginaction. Action, The execute method in jcuckoo. loginaction is called. If the requested URL is registeraction. Action, The execute method in jcuckoo. registeraction is called;
Form 3: dynamic results
<Action name = "crud _ *" class = "jcuckoo. crudaction "method =" {1} "> <result name =" input ">/input. JSP </result> <result>/{1 }. JSP </result> </Action>
When the processing result is input, the/input. jsp page is displayed.
October 2014 licensed physician Qualification Examination comprehensive medical examination clinical licensed physician oral licensed physician TCM licensed physician
When the processing result is success,
If crud_create.action is used, the create method in jcuckoo. crudaction is executed and jumps to/create. jsp. If crud_delete.action is used, the delete method in jcuckoo. crudaction is executed and the method jumps to/Delete. jsp;
Method call method under struts2 action