Hi all,
 
Does anybody know how to override a servlet context defined in
server.xml with the one defined in web.xml?  Please help....
 
According to Tomcat 5.x document, the context for a servlet, say
myservlet, can be specified in both TOMCAT_HOME/conf/server.xml and in
TOMCAT_HOME/wenapps/myservlet/WEB_INF/web.xml. 
 
The following Context in server.xml
 
<Context path="/myservlet" reloadable="true"  >
     <Environment name="somename" value="666" type="java.lang.String"
override="true"/>
</Context>
 
is equivalent to the following in web.xml
 
<env-entry>
      <env-entry-name>somename</env-entry-name>
      <env-entry-value>888</env-entry-value>
      <env-entry-type>java.lang.String</env-entry-type>
</env-entry>
 
The document says that if override="true", <env-entry-value> in web.xml
will override Environment value in server.xml.
 
I tried in my project and it does not work.
 
The code I Use to retrieve the context is something like
 
InitialContext lContext = new InitialContext();
String lValue = (String) lContext.lookup("java:comp/env/somename");
 
The problem is: lValue is always 666 while it should be 888 according to
the spec 
 
Can anybody help?
 
 
Thank you in advance.
 
Fengmin
 

Reply via email to