File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes different between parameters and attributes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "different between parameters and attributes" Watch "different between parameters and attributes" New topic
Author

different between parameters and attributes

anarkali perera
Ranch Hand

Joined: Sep 10, 2009
Posts: 237
is the only different between parameters and attributes is attribute can store object but parameter only can store String.
is there any other differences?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61760
    
  67

They really have nothing to do with each other. Parameters are values that are submitted as part of the HTTP request to the servlet, while attributes (also known as "scoped variables") are values created by the servlets and stored in one of the various scopes.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3859

You can use parameters with the request URL(s), but you can store attributes in various objects like ServletRequest, HttpSession, ServletContext and also in PageContext for JSP.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61760
    
  67

Vijitha Kumara wrote:You can use parameters with the request URL(s)

Not quite accurate. You don't really "use" parameters with URLs. But as I stated, servlet parameters are the result of request parameters submitted on an HTTP request. Whether the parameter data is carried on the URL or within the request body depends upon the type of the request.

but you can store attributes in various objects like ServletRequest, HttpSession, ServletContext and also in PageContext for JSP.
Yes, those are the scopes that I mentioned. Page scope is not available from servlets.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: different between parameters and attributes