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
posted
0
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
posted
0
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
posted
0
Kapil & Subramanian,
Thanks for your help!!
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.