Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dout in request scoped attribute and parameter

 
Sudarshan Sreenivasan
Ranch Hand
Posts: 188
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

I want to know the difference between the scope (visiblity) of a request scoped attribute (request.setAttribute() ) and request parameter (name/value pairs that come from a form)

thanks
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sid,

request Paramerters -

These will bundled by container into ServletRequest implementation Object.
Scope is available to all filters/sevlets/jsps wihch are participating in that request,response chain.
(be careful here request parameters can also be over-ridden while forwarding to another component, but still we can get the original queryString)

Once the response it committed. Thats it container will throw them away.
we are not expected to hold the references to them

request Attributes -

Are added at server side After the ServletRequest is available to
filter/servlet/jsp's.

SCOPE is same as request parameters. These can be dynamically changed by any component participating in the request -- response chain.
[ August 19, 2007: Message edited by: Srinivasan thoyyeti ]
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a parameter will aways be a String while attributes can be any object but will be retrieved (getAttribute) as an object and you will have to cast to the object type
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic