On Mon, 8 Jul 2002, Mark O'Driscoll wrote:

> Date: Mon, 8 Jul 2002 14:48:49 +0100
> From: Mark O'Driscoll <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Re: Default Servlet Parameters
>
> I have a supplementary question to this.
>
> Is there any accepted way to pass parameters to servlets/jsps that may be
> edited?
>
> I can see that <init-param> & <context-param> do what I want but I need to
> allow a user to change values of some parameters, save them and the new
> values would be used subsequently. I don't want to have my code re-writing
> web.xml or server.xml.
>
> I guess I could have a context parameter pointing to an OS file that would
> contain parameter sets in XML or java property sets. Any other approaches?
>

A properties file pointed at by an initialization parameter is the most
common approach.  Another option is to make your "configuration settings"
things in the database that a user can edit through admin-type screens in
your webapp.

> Oh, that's another question. Any common software out there that can easily
> parse an XML property file or can I use some of the tomcat libraries?
>

Check out the Digester package at Jakarta Commons.  It's what Tomcat
(4.1.x and later) uses to parse server.xml and web.xml files, and it's
also used by many other applications (such as Struts) for the same reason.

  http://jakarta.apache.org/commons/digester/

Craig


> ----- Original Message -----
> From: "Shapira, Yoav" <[EMAIL PROTECTED]>
> To: "Tomcat Users List" <[EMAIL PROTECTED]>
> Sent: Monday, July 08, 2002 2:33 PM
> Subject: RE: Default Servlet Parameters
>
>
> Howdy,
> You shouldn't be giving other parameters to tomcat's own DefaultServlet.
>
>
> Your own servlets have no limitations on the number of name of
> variables: you can have as many <init-param> tags in your <servlet> tags
> as you want.
>
> If you want some params common to all the servlets in your web-app, use
> <context-param> instead, outside your <servlet> tags.
>
> Yoav Shapira
> Millennium ChemInformatics
>
>
> >-----Original Message-----
> >From: Manchan [mailto:[EMAIL PROTECTED]]
> >Sent: Tuesday, July 02, 2002 4:44 PM
> >To: [EMAIL PROTECTED]
> >Subject: Default Servlet Parameters
> >
> >*** THE QUESTION ***
> >
> >I'd like to load global init parameters for my
> >servlets on Tomcat, in the manner which Jserv
> >accomplishes with its |zone.properties| file using the
> >line |servlets.default.initArgs=myParameter=myValue|.
> >
> >*** MY GUESS TO QUESTION ***
> >
> >I presume the Tomcat analogue to the above is adding
> ><init-param> tags to $TOMCAT/conf/web.xml, e.g.
> >
> ><servlet>
> >   <servlet-name>default</>
> >   <servlet-class>org.path.to.DefaultServlet</>
> >   <init-param>
> >      <param-name>myParameter</>
> >      <param-value>myValue</>
> >   </init-param>
> ></servlet>
> >
> >*** UNFORTUNATELY ***
> >
> >In DefaultServlet.java, it statically loads only five
> >init-parameters, namely "debug", "input", "listings",
> >"output", "readonly".  I would need to alter Tomcat
> >code to accept |myParameter|.  There must be a better way.
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Sign up for SBC Yahoo! Dial - First Month Free
> >http://sbc.yahoo.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]>
>
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


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

Reply via email to