This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • 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
---------------------------------------------------------------------------
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!