From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Is there any reference available with samples what can be stored in 
> web.xml and how to access the property?
> In the examples context I found the following entries in web.xml:
> 
>     <env-entry>
>       <env-entry-name>name3</env-entry-name>
>       <env-entry-value>1</env-entry-value>
>       <env-entry-type>java.lang.Integer</env-entry-type>
>     </env-entry>
> 
> How can I access these values? Are these accessible using 
> servletcontext.getInitParameter("name3")? Is it getting 
> casted to Integer 
> automatically?

Try something like this:

import javax.naming.Context;
import javax.naming.InitialContext;
...
Context initialContext = null;
try {
        initialContext = new InitialContext();
}
catch (Exception e) {
      out.print("<li>Cannot get initial context for JNDI: ");
      out.println(e + "</li>");
        return;
}
Integer envEntry = null;
try {
        envEntry = (Integer) initialContext.lookup("java:comp/env/name3");
} 
catch (Exception e) {
        out.println("<li>Cannot get env-entry on JNDI " + e + "</li>");
      return;
}
...

See  http://www.objectweb.org/jonas/current/doc/PG_War.html for a more
complete explanation - it really helped me.

-Phil


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to