servlet中如何获得pageContext

来源:互联网 发布:我想学计算机编程 编辑:程序博客网 时间:2024/05/17 05:15

1.获取pageContext


JspFactory jsp1 = JspFactory.getDefaultFactory();


        PageContext pageContext = jsp1.getPageContext(this, request, response,

null,true,8192, true);//


//this表示本类servlet对象


//null 是指定错误页面java.lang.String errorPageURL


//true 是否需要session


//8192 缓冲区大小


//true是否缓冲

2.获取ServletConfig


ServletConfig config = this.getServletConfig();


SmartUpload myUpload = new SmartUpload();


myUpload.initialize(config, request, response);


myUpload.upload();

原创粉丝点击