dcsimg
Problem extending jsp from servlet in jdeveloper
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   zhidong_zhao
Posted On:   Saturday, January 25, 2003 05:42 PM

The question was asked in appserver forum and was not answered in two days. I post it again in jsp forum hope somebody can help me. While developing a jsp with jdeveloper 9.0.2, I extended the jsp from a predefined servlet which extends HttpServlet implements JspPage. The jsp sees all super class attributes, but only the methods defined in orionHttpJspPage, even if I let the servlet extends directly from orionHttpJspPage. The jsp does not compile if methods that are not defined in orionHttpJspPage are called. However, those methods can be invoked through java reflection. What's wrong? My code segments are attached as follows: the jsp: <%@ page extends="MicromagJS   More>>

The question was asked in appserver forum and was not answered in two days. I post it again in jsp forum hope somebody can help me.



While developing a jsp with jdeveloper 9.0.2, I extended the jsp from a predefined servlet which extends HttpServlet implements JspPage. The jsp sees all super class attributes, but only the methods defined in orionHttpJspPage, even if I let the servlet extends directly from orionHttpJspPage. The jsp does not compile if methods that are not defined in orionHttpJspPage are called. However, those methods can be invoked through java reflection. What's wrong?


My code segments are attached as follows:


the jsp:


<%@ page extends="MicromagJSP.ServletBase" %> <%


super.jspInit(); //works


destroy(); //works


super.vvv(); //does not compile


abc(); //does not compile



//the method names abc or vvv are printed on screen


//and methos are called successfully


java.lang.reflect.Method[] methods = getClass().getMethods();

for (int i=0; i


{


out.println(methods[i].getName());


out.println("");


if (methods[i].getName().equals("abc"))


{


java.lang.reflect.Method method = methods[i];


String str = (String)method.invoke(this, new Object[]{});


out.println("method invoked "+method.getName());


out.println("br /> current time="+str);


}


}


%>



the servlet:


package MicromagService;


public abstract class ServletBase extends com.orionserver.http.OrionHttpJspPage //or HttpServlet implements HttpJspPage

{


public void jspInit() {} //this is seen by jsp



public void jspDestroy() {} //this is seen by jsp


public void vvv() { } // this is not seen by jsp



public String abc() throws IOException // this is not seen


{


return java.util.Calendar.getInstance().toString();


}


}

   <<Less
About | Sitemap | Contact