Summary of four methods for passing parameters to the backend by JSP, four types of jsp backend Parameters

Source: Internet
Author: User

Summary of four methods for passing parameters to the backend by JSP, four types of jsp backend Parameters

Jsp page value passing Method

I,The client submits the data to the server through the Form. The server submits the data to the server through the Form.

Java code

Request. getParameter (String xx );

To obtain the parameter (xx) as the parameter name.

Submit in get/post Mode

II,Hide a field to pass a value

You can add a hidden field to the form to submit it to the server. The advantage of this method is that you can add some parameters you want to add on the client to get the corresponding values.

Client code:

Java code

<Input type = "hidden" name = "id" value = ""/>

Server value:

Java code

String id = request. getParameter ("id ");

III,The value passing method through URL is to pass the value in Java code. Xx. jsp indicates to submit to the processing page, followed? The parameter and its value are to be passed, and the parameter and parameter are separated.

IV,Passing values through JavaBean means that the values of all forms are passed into a JavaBean through the introspection mechanism in Java.

The above four methods of passing parameters to the backend in JSP are all the content shared by the editor. I hope to give you a reference and support for the customer's house.

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.