I,
Simple comparison
Request. getparameter is familiar with many applications.
Request. getparametervalues (string name) is used to obtain data such as the checkbox class (with the same name but multiple values. Receive array Variables
, Such as the checkobx type
Request. getparameter (string name) is used to obtain the data of the corresponding name. If a duplicate name exists, the first value is returned.
. Receive common variables
, Such as text type
Example:
1. Three text labels with the same name
<Input type = "text" name = "test" value = "1"/>
<Input type = "text" name = "test" value = "2"/>
<Input type = "text" name = "test" value = "3"/>
Request. getparametervalues ("test") --------------- [1, 2, 3]
Request. getparameter ("test") ------------------ 1
$ {Paramvalues. Test}
$ {Param. Test}
2. checkbox
<Input type = "checkbox" name = "habit" value = "read"> reading
<Input type = "checkbox" name = "habit" value = "movie"> movie
<Input type = "checkbox" name = "habit" value = "game"> games
Request. getparametervalues ("habit ")
Ii. Related Topics ------ hidden objects
1. jsp implicit object (implicit object)
Implicit objects refer to objects that can be directly used when writing JSP pages without any declaration. Jsp2.0 defines nine implicit objects
Request Response pagecontext session application out conifg page exception
Here we only mention two objects: request and response.
The request object indicates the content of the client request. For example, we have obtained the user input content from the request and implemented the javax. servlet. http. httpservletrequest interface.
The response object is the response result of the client.
The above two methods of request are used: getparameter and getparametervalues. In fact, there are several other important methods in request. Here, only a few methods are involved to obtain request parameters.
String getparameter (string name) gets the name parameter value
String [] getparametervalues (string name) Get the parameter values of all names
Enumeration getparameternames () Get all parameter names
Map <string, string []> getparametermap () gets a ing of all parameters in the request
//
-
Returns a java. util. Map of the parameters of this request.
Request Parameters
Are extra information sent with the request. For HTTP Servlets,
Parameters are contained in the query string or posted form data.
-
-
Returns:
-
An Immutable java. util. Map containing parameter names
Keys and parameter values as map values. The keys in the Parameter
MAP are of Type string. The values in the parameter map are of Type
String Array.
//
Response and other hidden objects also have very important identities. They have the opportunity to sort out and publicize their prominent position.
2. El implicit object
El is the experssion language. Since jsp2.0, El has become one of the standard JSP specifications. It also supports the El Syntax of servlet2.4/jsp2.0.
A common form is as follows: <C: Out value = "$ {3 + 7*4}"/>
The hidden object of El has 11 pagecontext pageconrequestscope sessionscope applicationscope
Param paramvalues
Header headervalues cookie initparam
Param and paramvalues correspond to the corresponding servletrequest. getparameter (string name) and servletrequest. getparametervalues (string name)