File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Attribute versus Parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Attribute versus Parameter" Watch "Attribute versus Parameter" New topic

Attribute versus Parameter

Swapnil Sanghai
Ranch Hand

Joined: Dec 05, 2011
Posts: 41

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

Joined: Oct 14, 2005
Posts: 19973

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

Joined: Dec 05, 2011
Posts: 41

Thanks Paul.
I agree. Here's the link:
subject: Attribute versus Parameter
It's not a secret anymore!