You should use properties files... or system properties....
i thinkis the best option.

Amos Shapira wrote:

> Sounds like an application-level configuration parameter, since you
> don't want the user to specify the URL in a request would you?
>
> At least with servlets 2.2, you can define application-level init parameters
> with a <context-param> tag in the web.xml file.
>
> Other possibilities might be to use properties, though my personal
> taste leans towards the web.xml option.
>
> Hope this helps,
>
> --Amos Shapira
> WebCollage
>
> > -----Original Message-----
> > From: Robert [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, July 05, 2000 11:14 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: How to retrieve param, forwarded to a servlet.
> >
> >
> > The thing is that I'm connecting to a database in the
> > init() method. And I would like the database url to be
> > a parameter instead of hard-coded in the servlet.
> >  Is this possible when request parameters doesn't
> > work in init()? Is there another way around this?
> >
> > /Robert Karlsson
> >
> > On Wed, 5 Jul 2000, Carlos Olmos wrote:
> >
> > > Right.... and, as a matter of fact, init() is called only
> > once in the lifetime
> > > of the servlet... (that is what make servlets more
> > efficient than cgi's)... so
> > > you can't associate a request and its parameters with the
> > init() method....
> > >
> > > carlitos.
> > >
> > >
> > >
> > > Milt Epstein wrote:
> > >
> > > > On Tue, 4 Jul 2000, Robert wrote:
> > > >
> > > > > I can retrieve the value from the parameter in doGet()
> > but not in
> > > > > init(). Anyone know why? And what must I do to be able
> > to retrieve
> > > > > the value in the init() method?
> > > >
> > > > I don't believe you can get a parameter in init() (we're
> > talking about
> > > > request parameters here, not init parameters).  init()
> > doesn't have a
> > > > request object available, as doGet()/doPost() do.  And it
> > needs to be
> > > > that way because it's possible for init() to be called outside the
> > > > context of a request.
> > > >
> > > > > On Tue, 4 Jul 2000, Robert wrote:
> > > > >
> > > > > > Hello,
> > > > > >
> > > > > > How can I retrieve the parameters in a servlet
> > > > > > that I send in a jsp:
> > > > > >
> > > > > > <jsp:forward page="someservlet">
> > > > > >  <jsp:param name="varname" value="sumvalue">
> > > > > > </jsp:forward>
> > > > > >
> > > > > > To my knowledge I'm supposed to use the request
> > > > > > object with the getParameter("varname") or
> > > > > > getParameters(). But I can't seem to get it
> > > > > > working.
> > > > > > I want to retrive the parameter in the servlets
> > > > > > init() method.
> > > > > >
> > > > > > Anyone having a solution, please?
> > > > > >
> > > > > > /Robert Karlsson
> > > >
> > > > Milt Epstein
> > > > Research Programmer
> > > > Software/Systems Development Group
> > > > Computing and Communications Services Office (CCSO)
> > > > University of Illinois at Urbana-Champaign (UIUC)
> > > > [EMAIL PROTECTED]
> > > >
> > > >
> > ______________________________________________________________
> > _____________
> > > > 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
> >
>
> ___________________________________________________________________________
> 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

___________________________________________________________________________
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