版权声明:本文为博主原创文章,转载请注明出处! https://blog.csdn.net/sinat_34104446/article/details/82755591
目录
一、问题描述
1.使用SmartUpload上传文件,因为原来其是用在JSP中进行文件上传,而JSP自带PageContext对象,但是在Servlet中又该如何获取?
二、问题解决
1.需要使用 JspFactory.getDefaultFactory().(servlet, request, response, errorPageURL, needsSession, buffer, autoflush);
2.注意要在Servlet中,不然this位置需要创建一个Servlet或者其子类对象
// servlet, request, response, errorPageURL, needsSession, buffer, autoflush
PageContext pageContext = JspFactory.getDefaultFactory().(this, request, response, null, true, 8192, true);