Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

NPE with getContext() in a jsp

Chris Cheshire

2003-08-15

Replies:

Hi,

Using tomcat 4.0.24, I have some <context-param>s defined in my web.xml.

In my servlets, I am able to access these values with

getServletContext().getInitParameter("some name")

However, if I try and do the same from a jsp page in this web
application I get the following NPE

java.lang.NullPointerException
    at
javax.servlet.GenericServlet.getServletContext (GenericServlet.java:204)
    at org.apache.jsp.main_jsp.getIntContextParam(main_jsp.java:45)
    at org.apache.jsp.main_jsp.<init>(main_jsp.java:73)
.......

It appears getServletContext() is the culprit. How do I retrieve the
<context-param>s from my jsp?

Thanks

Chris



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.