tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cédric Viaud <cedric.vi...@matrasi-tls.fr>
Subject Re: web.xml default parameters to a servlet
Date Wed, 07 Aug 2002 11:49:21 GMT
<!--
The init-param element contains a name/value pair as an
initialization param of the servlet
Used in: filter, servlet
-->
<!ELEMENT init-param (param-name, param-value, description?)>

You can acces it in your servlet class by this.getInitParameter(param-name);

Ex :
<init-param><param-name>myparam</param-name><param-value>myvalue</param-valu
e><description>is not required ...</description></init-param>

So in your servlet :
String initValue = this.getInitParameter("myparam");

Regards,

   Cédric


----- Original Message -----
From: "Rum Pel" <rum_pel@hotmail.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Wednesday, August 07, 2002 12:54 PM
Subject: Re: web.xml default parameters to a servlet


> Hello!
>
> What is the meaning of init-param element in the Web.xml?
> Any comments on my problem?
>
> --rp.
>
> >From: "Rum Pel" <rum_pel@hotmail.com>
> >Reply-To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> >To: tomcat-user@jakarta.apache.org
> >Subject: Re: web.xml default parameters to a servlet
> >Date: Tue, 06 Aug 2002 00:32:39 -0400
> >
> >
> >>To my generic servlet I want to attach two URLs, but I dont want
> >>to distinguish the two calls using the URLs. Instead I want tomcat
> >>to pass a default parameter to the servlet based on the URL.
> >>Is this possible, if yes what do I need to write in the web.xml?
> >>
> >
> >I tried using init-param tag, but my servlet did not get this
> >parameter.
> >
> >  <servlet>
> >        <servlet-name>userdel</servlet-name>
> >        <servlet-class>my.UserUtils</servlet-class>
> > <init-param>
> > <param-name>function</param-name>
> > <param-value>delete</param-value>
> > </init-param>
> >    </servlet>
> >
> >  <servlet>
> >        <servlet-name>useradd</servlet-name>
> >        <servlet-class>my.UserUtils</servlet-class>
> > <init-param>
> > <param-name>function</param-name>
> > <param-value>add</param-value>
> > </init-param>
> >    </servlet>
> >
> >In my servlet, I dont have the paramter function, its value it null.
> >
> >
> >_________________________________________________________________
> >Send and receive Hotmail on your mobile device: http://mobile.msn.com
> >
> >
> >--
> >To unsubscribe, e-mail:
> ><mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> >For additional commands, e-mail:
> ><mailto:tomcat-user-help@jakarta.apache.org>
>
>
>
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
>
> --
> To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>
>



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message