• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parameters vs Attributes

 
Prasanna Wamanacharya
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Both the ServletRequest and the ServletContext interfaces have methods for handling parameters, as well as attributes.
The differences I can make out between them are as foll:
* Parameters are read-only, while attributes are r/w
* Parameters are persistent by default(web.xml), while attributes are persistent by choice(if needed, can be stored in a database, file etc.).

Any other thoughts/suggestions/differences/uses/enlightenments.....
Thanks in advance,
Prasanna.
SCJP2
---------------------------------------------------------------------------
If I had eight hours to chop down a tree, I'd spend six sharpening my axe.
-Abraham Lincoln
---------------------------------------------------------------------------
[ March 06, 2002: Message edited by: Prasanna Wamanacharya ]
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the obvious statement that parameters are Strings read from descriptors, where as an attribute can be any Object you choose to attach to the context/request.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The differences I can make out between them are as foll:
* Parameters are read-only, while attributes are r/w
* Parameters are persistent by default(web.xml), while attributes are persistent by choice(if needed, can be stored in a database, file etc.).

Just curious, where did you pick this up?
Seems like I missed that section completely....
- satya
 
Prasanna Wamanacharya
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Satya,

Just curious, where did you pick this up?
Seems like I missed that section completely....
- satya

This is not related to any particular section of the objectives. I just had this thought while going through the API Docs.

Prasanna.
SCJP2
---------------------------------------------------------------------------
If I had eight hours to chop down a tree, I'd spend six sharpening my axe.
-Abraham Lincoln
---------------------------------------------------------------------------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic