Differences between the use of Submit and button in a JSP page's form

Source: Internet
Author: User

Today in doing additions and deletions to change, using the Javascrip language, add and modify after completion, in the delete, you need to use form form to obtain.

The problem is that after adding a form, adding and modifying features doesn't make it.

Here is the button code in my JSP page

The type should be a button, not a submit. (There can be multiple button buttons in a form form, but only one submit button)

Submit is a special case of the button and a button, which automatically integrates the commit action. If the form after the click on the Submit button needs to be processed with JS (including input validation) and then submit, it is usually necessary to change the submit to button, otherwise, will result in two times the effect, for Dynamic Web page, that is, the database operation two times. (excerpt from 劤 's footsteps )

Submit and Button differences:
(1) Submit the form submission (Form.submit ()) as the default event after its onclick, the button is not the case.

(2) When a form is submitted, all HTML input elements with the name attribute (including input tags, button labels, select Labels, and so on) are submitted as key-value pairs, except for the Submit object. The Submit object is only submitted as a key-value pair in the commit after it has been clicked.

It is important to understand the difference between them, because you can call Java directly in the JavaBean when using submit, and if you use a button, the response function for the button must be written in JavaScript. JavaScript cannot be called directly to Java, but only through DWR technology.

Can see http://blog.sina.com.cn/s/blog_693d183d0100uolj.html, this writing is quite detailed.

Differences between the use of Submit and button in a JSP page's form

Related Article

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.