"lightbulb432" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> I did notice the getServletContext() of the servlet classes, but in this
> case
> the code is in a custom class that was forwarded to by the servlet - I
> don't
> have access to the servlet in this class.
>
> If howe
> From: lightbulb432 [mailto:[EMAIL PROTECTED]
> Subject: RE: HttpSession questions
>
> If however, I were to change my code and pass the return
> value of Servlet's getServletContext() to my class, would
> a session still be created
No, no session is created.
> Out
I did notice the getServletContext() of the servlet classes, but in this case
the code is in a custom class that was forwarded to by the servlet - I don't
have access to the servlet in this class.
If however, I were to change my code and pass the return value of Servlet's
getServletContext() to m
It's also available via the servlet class. See
http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/GenericServlet.html#getServletContext()
If you are trying this via jsp, it should be available via PageContext. See
http://tomcat.apache.org/tomcat-5.5-doc/jspapi/javax/servlet/jsp/
> From: lightbulb432 [mailto:[EMAIL PROTECTED]
> Subject: HttpSession questions
>
> Why is it that you need an HttpSession in order to get a
> ServletContext?
You don't - since your code is in a class that extends HttpServlet, just
call getServletContext() directly; it's defined under
javax.ser