Multiple actions in a form

Source: Internet
Author: User

If you want to assign multiple operations to a form. For example:

In this form, you want to have two actions: "Delete" and "move. However, a form only processes one action.

How can we use one action to deal with two different operations?

In the servlet parameter httpservletrequest req, there is a function named getparameternames ().

This parameter indicates:

Returns EnumerationOf StringObjects ining the names of the parameters contained in this request. If the request has no parameters, the method returns an empty Enumeration.
Returns:
An EnumerationOf StringObjects, each StringContaining the name of a request parameter; or an empty EnumerationIf the request has no parameters

In other words, it can return the names of all parameters in the request object.

In this way, we can assign different buttons with different names to distinguish which operation we click.

For example:

Print the array returned by the getparameternames () function in the servlet and you can see:

When we click"Delete", The output content is:

When we click"Mobile", The output content is:

That is to say, each operation only has one operation. Therefore, you only need to make logical judgments to know what operations the selected checkbox is intended.

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.