• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletContext.setAttribute and init_params

 
Aruna Raghavan
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How are the parameters that get set in init_param section of web.xml different from "attributes" that can be set on or gotten from the ServletContext?
Thanks,
Aruna.
 
Aruna Raghavan
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, let me rephrase that-
Hi,
How are the parameters that get set in context_param section of web.xml different from "attributes" that can be set on or gotten from the ServletContext?
Thanks,
Aruna.
 
Dharmin Desai
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the context param section, we can set Intialization parameters for servlet Context which can not be reset again programatically, whereas using ServletContext.setAttribute() and ServletContext.getparameter(), u can reset/get any number of parameters at RUNTIME.
=> These r the init parameters for ServletContext.
One another set of parameters r there for Servlet alone which is not shareable at Context level.
These init parameters reside under <Servlet> .. </servlet> tag and r only for this servlet.
Hope i m clear enough.
best regards, Dharmin
 
Rishi Yagnik
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey Dharmin and Aruna
i found u both of u wrong
aruna is wrong is question context-param
and dharmin there is no method calles getParameter it getInitParam(String).
and about question setAttribute gives u a flexibility for setting a attributes as well as api also gives u a flexibility for removing that attribute.It also bounds an Object where in case of context-param u can sepecify String para only not Objects.
I hope this is much clear
Rishi
 
Aruna Raghavan
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to both of you.
I thought I rephrased the question. I did understand what Dharmin was saying also.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic