users@glassfish.java.net

Re: making env-entry available to helper classes

From: <glassfish_at_javadesktop.org>
Date: Mon, 19 Mar 2007 07:45:22 PST

Hi Jean,

Java EE 5 does not support the environment annotations for Helper classes. However, you
can always look up any entries within the component environment using java:comp/env. So,
you can continue to define the environment-entry using @Resource in the servlet / web.xml,
and add the following code to your helper class :

    String dbType = (String) new InitialContext().lookup("java:comp/env/dbType");

 --ken
[Message sent by forum member 'ksak' (ksak)]

http://forums.java.net/jive/thread.jspa?messageID=208734