GetParameter and getattribute--aloof Wolf blog HttpServletRequest A detailed explanation of the article

Source: Internet
Author: User

Typically use GetParameter for parameters passed on forms and links

Use Request.getattribute ("name") to assign values by Request.setattribute ("name", "Jerry")


This question is the difference between request and session, the request scope is smaller, just a petition, simply say that you are on the page an operation, Request.getparameter () is from the previous page in the URL, form to get parameters, But if a request involves more than one class, the parameters are taken later, Request.setattribute () and Request.getattribute () can be used, but when the result is output, the request ends.

The session can span many pages and can be understood as multiple requests from the client's same IE window. This can be passed between parameters, such as a lot of Web site user login is used.

Can generally use GetParameter to get page parameters ... String...

GetAttribute () can get the object ...


GetParameter can get the parameters such as the page coming in? Id=123 or something like that.

GetAttribute () is commonly used for servlet page pass parameters to JSP

GetParameter and getattribute--aloof Wolf blog HttpServletRequest A detailed explanation of the 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.