The following describes nine common built-in JSP objects. Next, let's talk about their respective features. Let's talk about the request today.
Below are some common request methods:
Isuserinrole (string role ):Determine whether the authenticated user is a member of the logical role.
Getattribute (string name ):Returns the attribute value specified by name. If no value exists, null is returned.
Getattributenames ():Returns the specified property set by name. The result is an enumeration instance.
Getcookies ():Returns all cookie objects of the client. The result is a cookie array.
Getcharacterencoding ():Returns the encoding of Characters in the request.
Getcontentlength ():Returns the length of the Request body. If the length is not determined,-1 is returned.
Getheader (string name ):Obtain the file header defined by HTTP.
Getheaders (string name ):Returns all the values of all request headers with the specified name. The result is an enumeration instance.
Getheadernames ():Returns the names of all request headers. The result is an enumeration instance.
Getinputstream ():Returns the input stream of the request to obtain data in the request.
Getmethod ():Methods for obtaining data transmitted from a client to a server, such as get, post, header, and trace.
Getparameter (string name ):Obtain the parameter values sent from the client to the server, and obtain the parameters submitted by get and post.
Getparameternames ():Obtain the names of all parameters sent from the client to the server. The result is an enumeration instance.
Getparametervalues (string name ):Obtains all values of a specified parameter.
Getprotocol ():Obtain the protocol name that the client uses to transmit data to the server.
Getquerystring ():Obtain the query string, which is submitted in get mode.
Getrequesturi ():Obtain the client address of the request string.
Getremoteaddr ():Obtain the IP address of the client.
Getremotehost ():Obtain the client name.
Getsession ([Boolean create]):The request-related session is returned. The create parameter is an optional parameter. If the create parameter is set to true and the client does not create a session, a new session is created.
Getservername ():Obtain the name of the server.
Getservletpath ():Obtain the path of the script file requested by the client.
Getserverport ():Obtain the port number of the server.
Removeattribute (string name ):Delete an attribute in the request.
Setattribute (string name, java. Lang. Object objt ):Set the value of the request parameter named name, which is specified by Java. Lang. Object-type objt.
These methods are relatively simple and you don't need to talk about them. I will not mention it here.