I had the same issue.. I cant find anything in the APIs that offer support
for multiple values for the same param in the init params methods. I had to
use a second XML file and use a XSL file to load it in as an array. The
approach of using an XSL is so that I can use the array in javascript only.
If you want to be able to use the values in Server side code, you have to
write a simple XML parser.
-Tim

-----Original Message-----
From: Gerry Scheetz [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 03, 2002 1:00 PM
To: [EMAIL PROTECTED]
Subject: loading array of data from InitParameter


I am trying to keep from having to constantly edit and recompiling my
servlet class.  To do this I would like to move the information that is
stored in an array to the applications web.xml file and loaded in the init
method rather than hard coding the creation of the array.

The web.xml file would look like this:
      <init-param>
         <param-name>team</param-name>
         <param-value>GoodGuys</param-value>
      </init-param>
      <init-param>
         <param-name>team</param-name>
         <param-value>Enemy</param-value>
      </init-param>

The following is how I usually load the information from the web.xml file.
    ServletConfig config = getServletConfig();
    String teamName = config.getInitParameter("appName");

But do not know how to load the information into an array of String objects.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to