In a form within a Struts2 if there are multiple submit buttons, such as adding, updating, saving, etc.
These buttons use an action, call a different method, and perform a JavaScript check before calling.
How do I use this submit button?
After summing up the following:
First specify the namespace of the action in the form label header:
<s:form namespace= "/system/usermanager" >
The following calls are then:
<s:submit type= "image" Id= "find" value= "find" label= "Retrieve user information by specified criteria"
Src= "/issframe/images/btn/btn_find.jpg" cssclass= "Button_image"
onclick= "return checkinputforrequired ();" action= "User" method= "Dosearch"/>
The above is an example of a picture submission button, because the picture buttons are usually used in the project:
Execute JavaScript in the onclick, remember not to omit return.
Action is the name that you want to call the action that is defined in the STRUTS2 configuration file
Example: <action name= "user_*" class= "com.system.action.ManagerUserAction" method= "{1}" >
Note that no wildcard characters ("_" or "!") are included. , etc.).
Mothed is the corresponding method defined in the action class.
Test environment: Struts2.1.2 Tomcat 5.5.26 myeclipse 6