Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request.getParameter Vs request.getAttribute

 
Ann Kurian
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ann Kurian
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic