Use of single Form multi-picture submit button (submit) in Struts2

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.