The difference between Javaweb GetParameter and GetAttribute __java

Source: Internet
Author: User

The HttpServletRequest class has a setattribute () method, but no Setparameter () method

When GetParameter () is used for client redirection , the linked component obtains request parameters through the GetParameter () method when there is a link between two Web Components

When GetAttribute () is used for server side orientation , when a forwarding relationship is between two Web components, the forwarding target component shares the request with the forwarding source component through the GetAttribute () method. The data within the session scope.

From a deeper level of consideration,

The data passed by the Request.getparameter () method is uploaded from the Web client to the Web server side, representing the HTTP request data . The Request.getparameter () method returns the data of type string .

The data passed by the Request.setattribute () and GetAttribute () methods only exist within the web** container and are shared among Web components that have forwarding relationships . These two methods can set the **object type of shared data.

Request.getparameter () acquisition is achieved through the implementation of the container to obtain through similar post,get and other means of data passed in. is uploaded from the Web client to the Web server, representing the HTTP request data , returning the string

Request.setattribute () and getattribute () are only circulated within the Web container, only as part of the request processing phase, and are shared among Web groups that have forwarding relationships. These two methods can set the shared data of type Object .

Overall:

Request.getattribute () method returns an object that exists within the Reques,sessiont range

The Request.getparameter () method is to get the data that HTTP submits over.

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.