JSP built-in Object Request

Source: Internet
Author: User

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.


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.