aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Reading the ContextParams by Container Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Reading the ContextParams by Container" Watch "Reading the ContextParams by Container" New topic
Author

Reading the ContextParams by Container

ramaseshan T
Ranch Hand

Joined: Feb 17, 2005
Posts: 30
HFSJ Pg:215, Ans for question:2

Which statements about ServletContextinitialization parameters are true?

"They Should be used for data that changes frequently"
This answer is given as incorrect with the reason
ServletContext init parameters are only read at container start-up time


For the ServletContextListener example given in chapter:5, I am able to change the param-value for breed and see it getting reflected in my webpage.(Without redeploying tomcat)

Please clarify:
1. Are the context-init parameters NOT read only once by the container?How come the changes made by me are reflected?
2. The answer for this question should be "They should be used for data that changes frequently"


Ramaseshan T<br />SCJP 1.4
kapil munjal
Ranch Hand

Joined: May 11, 2004
Posts: 298
Please clarify:
1. Are the context-init parameters NOT read only once by the container?How come the changes made by me are reflected?
2. The answer for this question should be "They should be used for data that changes frequently"

The Servlet spec states that context-init parameters are read only once but different containers implement it differently. I think if we encounter this question in the exam then we should go the way it has been given HFSJ. Because the book is written by the authors of the exam.

No, the answer is correct and we should not say that they should be used for data that changed frequently. There may be other containers which donot read the values again after initialization of the application.

I hope it helps!!!

Kapil


Kapil Munjal
SCJP 1.4, SCWCD 1.4
PNS Subramanian
Ranch Hand

Joined: Jul 13, 2004
Posts: 150
Ramaseshan - Try an earlier version of Tomcat and you would be able to appreciate the answer. Guess you are using a version that is 5.0 or above.
ramaseshan T
Ranch Hand

Joined: Feb 17, 2005
Posts: 30
Kapil & Subramanian,

Thanks for your help!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading the ContextParams by Container