users@glassfish.java.net

howto: usage of _at_Resources ?

From: <glassfish_at_javadesktop.org>
Date: Thu, 15 Nov 2007 16:56:06 PST

How's the @Resources annotation used?

Can I use it to inject a List of Strings from the environment?

What does the configuration file look like?

Perhaps something like this?

======================

private @Resource List<String> welcomeMessage;
public class HelloWorld extends HttpServlet
{
 public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
 {
   PrintWriter out = response.getWriter(); out.println(welcomeMessage);
}
...

<env-entry>
 <env-entry-name>welcomeMessage</env-entry-name>
 <env-entry-type>java.lang.String</env-entry-name>
 <env-entry-value>list element 1</env-entry-value>
</env-entry>
<env-entry>
 <env-entry-name>welcomeMessage</env-entry-name>
 <env-entry-type>java.lang.String</env-entry-name>
 <env-entry-value>list element 2</env-entry-value>
</env-entry>
[Message sent by forum member 'frenchdrip' (frenchdrip)]

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