Howdy,
There are a couple of ways.  My favorite is:

<param-name>jndi.resources</param-name>
<param-value>jndi/a,jndi/b,jndi/c</param-value>

String jndiString =
getServletContext().getInitParameter("jndi.resources");
StringTokenizer st = new StringTokenizer(jndiString, ",");
ArrayList jndiResources = new ArrayList();

while(st.hasMoreTokens())
{
  jndiResources.add(st.nextToken());
}

That's it, very simple.  ;)

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Soefara Redzuan [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, July 23, 2002 7:08 PM
>To: [EMAIL PROTECTED]
>Subject: context-param for a list/array of values ?
>
>In web.xml, variables can be defined like this,
>
>  <context-param>
>         <param-name>gui.bgcolor</param-name>
>         <param-value>#ffff00</param-value>
>  </context-param>
>
>And then in your servlet or JSP,
>
>  String guiBgColor =
getServletContext().getInitParameter("gui.bgcolor");
>
>But how can I assign a list or array of values to a variable
>in web.xml ?  For example, I wish to configure the available
>JNDI datasources available to a webapp, so that the end user
>can select one. Is it something like this ?
>
>  <context-param>
>         <param-name>jndi.resources</param-name>
>         <param-value>jdbc/users</param-value>
>         <param-value>jdbc/accounts</param-value>
>         <param-value>jdbc/finance</param-value>
>  </context-param>
>
>But then how would I extract values in my JSP or servlet ?
>
>Soefara
>
>_________________________________________________________________
>Join the world's largest e-mail service with MSN Hotmail.
>http://www.hotmail.com
>
>
>--
>To unsubscribe, e-mail:   <mailto:tomcat-user-
>[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:tomcat-user-
>[EMAIL PROTECTED]>


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

Reply via email to