When I reference 'session' or 'request' from within a method contained in a declaration, I get an 'Undefined variable' compile error. Why?

John Zukowski

The implicit objects session, request, etc. are defined in the JSP service method _jspService(). The are not instance level variables of the created JSP class. Hence, they are not immediately available to methods outside the service method. You would need to pass them in as parameters.