jsp页面:
<%
Class c = Class.forName("com.haha.service.impl.CommonDynamicTreeServiceImpl");
Constructor cons = c.getConstructor(new Class[]{pageContext.getClass()});
%>
------------------------------------------------------------------------
CommonDynamicTreeServiceImpl.java
public class CommonDynamicTreeServiceImpl extends BaseMVCService implements
CommonDynamicTreeService {
public CommonDynamicTreeServiceImpl(PageContext pagecontext)
{
this.pagecontext=pagecontext;
}
}
-----------------------------------------
BaseMVCService.java
public class BaseMVCService {
protected PageContext pagecontext; public final PageContext getPagecontext() {
return pagecontext;
} public final void setPagecontext(PageContext pagecontext) {
this.pagecontext = pagecontext;
}
}
---------------------------------------------------------------
public interface CommonDynamicTreeService {
}
<%
Class c = Class.forName("com.haha.service.impl.CommonDynamicTreeServiceImpl");
Constructor cons = c.getConstructor(new Class[]{pageContext.getClass()});
%>
------------------------------------------------------------------------
CommonDynamicTreeServiceImpl.java
public class CommonDynamicTreeServiceImpl extends BaseMVCService implements
CommonDynamicTreeService {
public CommonDynamicTreeServiceImpl(PageContext pagecontext)
{
this.pagecontext=pagecontext;
}
}
-----------------------------------------
BaseMVCService.java
public class BaseMVCService {
protected PageContext pagecontext; public final PageContext getPagecontext() {
return pagecontext;
} public final void setPagecontext(PageContext pagecontext) {
this.pagecontext = pagecontext;
}
}
---------------------------------------------------------------
public interface CommonDynamicTreeService {
}
解决方案 »
- 小弟不才
- Premature end of file. Nested exception: Premature end of file.这个错是什么原因?
- 对数据库采用Sybase时数据量很大的分页问题
- [求助] hibernate生成的sql不能在oracle中执行!
- 我要将oracle数据库内容转换成mysql的,怎么弄?说具体点,谢谢~!
- 一个关于servlet 找不到的问题
- 在eclipse中运行tomcat出错??在线等待
- 哪有weblogic 8 下载啊
- Applet的问题,困饶我好多天了
- The server encountered an internal error that prevented it from fulfilling this
- 23种设计模式,需要掌握熟练的有哪些
- eclipse如何建立web项目
怀疑你是jsp没引入正确的类包?
总之
无异常 无真相
你所便做一个类。他的构造函数是PageContext变量。
然后在jsp页面里面反射构造这个类。就不错。
但是我不知道。pageContext这参数的Class是什么啊?
和pageContext.getClass();
不同吗?
PageContext是个抽象类。
pageContext是apache tomcat容器的一个具体类。