Why multiple <param-name /> <param-value /> are allowed within a <context-param> tag?
Also noticed that ContextParam1 is overrided by ContextParam2 means in servlets getServletContext().getInitParameter("ContextParam2") returns "ContextValue2"
getServletContext().getInitParameter("ContextParam1") returns null.
I am not able to understand its behaviour.
Oracle Java Web Service Developer (1z0-897), Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I, CIW Certified Ecommerce specialist
I tested with <init-param> tag and I got the same output as incase of using <context-param>
In servlet specification 2.4, SRV.13.4 Deployment Diagram says <param-name> and <param-value> is mandatory elements. They showed this by using 'servlet' element(see it is 10th element). I guess the same applies for <context-param> also. They don't showed the number of occurances. I don't know, why 'Tomcat' implemented in this way. If we want multiple param's, generally we use like what 'Lucas' said above.
Yes i understand we should have seperate context param tag for each init param name/value pair.
I was playing around with web.xml and tried placing two name/value param within a single context-param and to my surprise Tomcat did not gave any deployment error/runtime error. Only thing is that param got overrided.
I want to know does this behaviour (overriding on param name/value pair) is dependent on Vendor implementation of J2EE Servlet Specs.
So, is it possible that if i try to run same code on some different Web container (for eg Sun server /BEA Weblogic/IBM Websphere) i might get different result