On Fri, 9 Mar 2001, 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?
init parameters and attributes are different things. Things set up as
context-param's in web.xml are available via the ServletContext
getInitParameter() (and getInitParameterNames()) method --
getAttribute() is for attributes.
The odd thing is that in the subject line of your note you mention
getInitParameter() (even though you indicate above that you're using
getAttribute()).
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, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]