Hi chris,

<init-params> specified in a <servlet> tag in the web.xml-<web-app>
context can be made available via the
ServletConfig.getInitParameter("name").

If you put them in <context-param> in the <web-app> they can be made
available
via the ServletContext object (instead of the ServletConfig as above)
--> ServletContext sc = ServletConfig.getServletContext()
    sc.getInitParameter("name")
Hth
Peter



chris hutchings wrote:
> 
> Hi,
> Thanks for the replies, but perhaps I was a bit vague
> in my description.
> 
> I have written a couple of example servlets which I
> placed in the \webapps\ROOT\WEB-INF\classes folder,
> and these work ok
> 
> The next example that I tried involved setting an
> <init-param> parameter in web.xml (for a counter) and
> a servlet that would use this value.
> (all copied out of a book)
> 
> Since I was using the \webapps\ROOT\WEB-INF\classes
> folder for my servlets, I altered the web.xml in
> /ROOT/WEB-INF.
> 
> The servlet executed ok, but the variable was not
> initialised � I printed it out an it was �null�
> 
> i.e. the servlets executing from
> \webapps\ROOT\WEB-INF\classes can not see the params
> specified in ROOT/WEB-INF/web.xml.
> 
> hmm, why is this?
> 
> i can now get the supplied examples to work,.
> 
> thanks  chris.
> 
> ____________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
> or your free @yahoo.ie address at http://mail.yahoo.ie

Reply via email to