This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes request.getParameter Vs request.getAttribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "request.getParameter Vs request.getAttribute" Watch "request.getParameter Vs request.getAttribute" New topic
Author

request.getParameter Vs request.getAttribute

Ann Kurian
Greenhorn

Joined: May 02, 2005
Posts: 2
Hi,
I am kind of new here..and I love browsing this forum as I am still a biginner in servlet programming.Please help !
Could you please explain to me the difference btn Request.getParameter and request.getAttribute. In one of the programs I am trying to write I want to pass a value (id) from the servlet to a parent class. I can set it up as request.setAttribute(�id�, 1). But in the parent java class , (which I cannot change) it uses the value id as request.getParameter(id). I am unable to set up the variable as request.setParameter in the Java class. Could anyone please explain how to solve this�
Thanks,
Ann
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

getParameter is what you use to retrieve HTTP form parameters from a webpost and is read only.

set and getAttribute are used for binding objects to request, session, or context scope.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ann Kurian
Greenhorn

Joined: May 02, 2005
Posts: 2
thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: request.getParameter Vs request.getAttribute