Summary of Four Ways of Passing Parameters to Background in JSP

  • 2021-12-09 09:41:57
  • OfStack

Method of Pass Value on Jsp Page

1. Submit and transfer value through Form form. The client side submits to the server side through Form form, and the server side passes through

Java code

request.getParameter(String xx);

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

Submit through get/post

2. Passing values through hidden fields

By adding a hidden field to the form to submit it to the server, the advantage of this way is that you can add some parameters you want to add to the client in order to get the corresponding values.

Client code:

Java code

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

Server side value:

Java code

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

3. Through URL, this way of passing value is to pass value through Java code. xx. jsp represents the page submitted to processing, and the following? The parameter to be passed and its value are followed by the number & Separate.

4. Passing values through JavaBean, that is, passing the values of all forms into one JavaBean through the introspection mechanism in Java


Related articles: