• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

different between parameters and attributes

 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic