Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Attribute versus Parameter

 
Swapnil Sanghai
Ranch Hand
Posts: 41
Java Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
I read the posts on the difference between the attribute and the parameter here.I got this by reading the posts.
Attributes are Objects and set by developer while parameters come from the user request.
Again the attributes are scoped variables.

But still I am having some doubts in my mind about the attribute and parameter

1. What is mean by there attributes "SCOPED VARIABLES" are parameters not scoped one?

2. Again what is need to set attributes externally? Why cant this facility provided for the parameter?

3. Why we do not have parameters as the objects?



I got this question in mind while I was writing above question that

Is attribute introduced later in Servlet and parameters are early one?
 
Paul Clapham
Sheriff
Posts: 21140
32
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that the request is an HTTP request. So it has parameters because HTTP says it has parameters. And those parameters are strings because HTTP says they are strings. This idea didn't just get invented by the people who designed the Java EE specifications, they implemented somebody else's requirements.

As for request attributes: sometimes it is useful to keep track of certain information while the request is being processed, and then discard it when that processing is finished. Hence a design which allows the programmer to do that. This information is called "request attributes". It's also convenient for them to be any Java objects, rather than making an artificial requirement that they have to be strings.
 
Swapnil Sanghai
Ranch Hand
Posts: 41
Java Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic