The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Parameters vs Attributes Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "Parameters vs Attributes" Watch "Parameters vs Attributes" New topic
Author

Parameters vs Attributes

Prasanna Wamanacharya
Ranch Hand

Joined: Apr 24, 2001
Posts: 143
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

Joined: May 08, 2001
Posts: 1932
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

Joined: Jun 03, 2000
Posts: 5040

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


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Prasanna Wamanacharya
Ranch Hand

Joined: Apr 24, 2001
Posts: 143
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
---------------------------------------------------------------------------
 
 
subject: Parameters vs Attributes
 
Threads others viewed
different between parameters and attributes
difference between servlets parameters and arguments
Difference between getParameter and getAttribute
SCWCD HFSJ query regarding chapter 5
difference between getParameter() and getAttribute()
developer file tools