Paolo Barolat-Romana wrote:

> I must be doing something wrong here.  In my code, I have the following
> line:
>
>  ServletContext servletContext = getServletConfig().getServletContext();
>
>  String fileName = (String) servletContext.getAttribute("filename");
>
> Now, this should return a string which I've setup in web.xml.  Here is
> the relevant part of web.xml:
>
> ?web-app?
>  ?context-param?
>   ?param-name?filename?/param-name?
>   ?param-value?c:\temp\file.txt?/param-value?
>  ?/context-param?
> .....
>
> But instead, this code is returning null.  Has this method not been
> implemented?
>
> Thanks,
>
> Paolo
> [...]

Hi :-)

ServletContext().setAttribute(...) and ServletContext().getAttribute(...)
are "a pair", we can sut/get some "context/myapp range" objects into/from
ServletContext() with this way.

if you want to get servlet context init parameters, I think we can use:
- set them in:
   % server.xml
   % ?context-param> in WEB-INF/web.xml -> I study it from your
       email(Email.this) just now,   I didn't try   ^_^
- get them with:  ServletContext().getInitParameter(...)


Bo
Mar.08, 2001




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to