dcsimg
problem accessing implicit objects in jspInit()
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   IVAN_VENUTI
Posted On:   Thursday, April 19, 2001 12:53 AM

I try to access the implicit objects "application" an "config" in my jspInit() method. Here is it an example: <%! public void jspInit() { System.out.println(":::::>"+application.getRealPath(".")); } %> Tomcat 3.1 reports this error: org.apache.jasper.JasperException: Unable to compile class for JSP/usr/tomcat3.1/jakarta-tomcat/work/localhost_8080%2FWinpal2/_0002ftest_0002ejsptest_jsp_5.java:21: Undefined variable or class name: application System.out.println(":::::>"+application.getRealPath(".")); ^ 1 error Where is the problem?    More>>

I try to access the implicit objects "application" an "config" in my jspInit() method. Here is it an example:


<%!
public void jspInit() {
System.out.println(":::::>"+application.getRealPath("."));
}
%>

Tomcat 3.1 reports this error:



org.apache.jasper.JasperException: Unable to compile class for JSP/usr/tomcat3.1/jakarta-tomcat/work/localhost_8080%2FWinpal2/_0002ftest_0002ejsptest_jsp_5.java:21: Undefined variable or class name: application

System.out.println(":::::>"+application.getRealPath("."));

^

1 error



Where is the problem?



-- Ivan Venuti --

   <<Less

Re: problem accessing implicit objects in jspInit()

Posted By:   Charles_Cuozzo  
Posted On:   Thursday, April 19, 2001 08:39 AM

Ivan:

The implicit objects are not available until the service() method of the JSP servlet is called. jspInit() is similar to the init() method in a servlet. The service() (or jsp_service()) method has not been called...the JSP/servlet has only just been loaded...so, no implicit objects yet.
About | Sitemap | Contact