Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Attributes X Parameters

 
Carolina Maia
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I read the HFSJ but It's not clear to me. What's the difference between them?

Thanks!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One simple thing you may not have noticed is that there is no setParameter, whereas there is a setAttribute. Dos this give you a hint ? Parameters are sent by the client to the container as part of the request, using a String to String (or String[]) map.
 
Cai DongShan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parameters come from client, cannot be changed by Servlet, only for request scope, the value is String (String[])

Attributes set by Servlet, can be any scope (Context/Session/Request), the value is Object

One more thing is init parameter. It is different from parameter.

Init Parameters set in web.xml, cannot be changed by Servlet, with Context/Request scopes, the value is String.
 
Carolina Maia
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank�s a lot...


Just one more thing: HFSJ has an example that we can use a listener to set an attribute in the DD. The ServletContextListener example, so.. Is that possible? DD has just parameters or attributes too?
 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DD has just parameters which you must consider as CONSTANT values.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic