aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Question on ServletContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Question on ServletContext" Watch "Question on ServletContext" New topic
Author

Question on ServletContext

Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442
We know the difference between init param and context param is scope.init param scope is for servlet and context param scope is for the web app. And also init param is initialized when container initiales servlet by calling init() method.After this if we change value of init param in DD,it is not reflected in servlet ,unless untill we redeploy/restart the server.How about Context parameter?If we change value of context parameter in DD,is it reflected in the servlet without even need of redeploying/restarting the server? Is ContextParameter value read only once when ServletContext is created,i.e when web app is deployed?

Thanks
Veena


SCJP1.4
"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
*Winston Churchill
Chandra Sagi
Ranch Hand

Joined: May 05, 2005
Posts: 162
Originally posted by Veena Point:
How about Context parameter?If we change value of context parameter in DD,is it reflected in the servlet without even need of redeploying/restarting the server? Is ContextParameter value read only once when ServletContext is created,i.e when web app is deployed?

Thanks
Veena


Hi,
You need to restart the server for the changes in DD to to be reflected. Container creates a new instance of ServletContext when it is started. A discussion on this is in HFJS book pages 159,160. Hope this helps.....

Thanks
Chandu
Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442
Yeah,read just now.Thanks.Just to be sure,everything happens,like creating ServletContext,reading context params from DD,creating config,reading init params from DD.....happens before container calls init method right?
[ March 01, 2006: Message edited by: Veena Point ]
Satish Ramasamy
Greenhorn

Joined: Feb 13, 2006
Posts: 15
Veena,
Yes you are right.


Thanks,<br />Satish<br /> <br />SCJP 1.4 - 98%
Chandra Sagi
Ranch Hand

Joined: May 05, 2005
Posts: 162
I guess when it happens when the init() method is invoked. Not before.

Thanks
Chandu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on ServletContext