SmartUpload su = new SmartUpload();
su.initialize(pageContext);
pageContext变量找不到,并且不能用new PageContext()定义该变量,如何解决呢?
在class="tags" href="/tags/ACTION.html" title=action>action中可以这样得到pageContetext对象
class="tags" href="/tags/IMPORT.html" title=import>import javax.class="tags" href="/tags/SERVLET.html" title=servlet>servlet.jsp.JspFactory;
class="tags" href="/tags/IMPORT.html" title=import>import com.jspsmart.upload.SmartUpload;
SmartUpload su = new SmartUpload();
JspFactory _jspxFactory = JspFactory.getDefaultFactory();
javax.class="tags" href="/tags/SERVLET.html" title=servlet>servlet.jsp.PageContext pageContext =
_jspxFactory.getPageContext(
this.getServlet(),
request,
response,
null,
true,
8192,true);
su.initialize(pageContext);
class="tags" href="/tags/SERVLET.html" title=servlet>servlet中
public class class="tags" href="/tags/SERVLET.html" title=servlet>servletUpload extends HttpServlet
{
private ServletConfig config;
public void destroy() { }
public void doGet(HttpServletRequest httpclass="tags" href="/tags/SERVLET.html" title=servlet>servletrequest,
HttpServletResponse httpclass="tags" href="/tags/SERVLET.html" title=servlet>servletresponse)
throws ServletException, IOException { }
protected void doPost(HttpServletRequest httpclass="tags" href="/tags/SERVLET.html" title=servlet>servletrequest,
HttpServletResponse httpclass="tags" href="/tags/SERVLET.html" title=servlet>servletresponse)
throws ServletException, IOException
{
SmartUpload smartupload = new SmartUpload();
try
{
smartupload.initialize(getServletConfig(), httpclass="tags" href="/tags/SERVLET.html" title=servlet>servletrequest, httpclass="tags" href="/tags/SERVLET.html" title=servlet>servletresponse);
smartupload.upload();
......
}
catch(Exception class="tags" href="/tags/EXCEPTION.html" title=exception>exception)
{
}
}
public final ServletConfig getServletConfig() { return config; }
public final void init(ServletConfig class="tags" href="/tags/SERVLET.html" title=servlet>servletconfig) throws ServletException
{
config = class="tags" href="/tags/SERVLET.html" title=servlet>servletconfig;
}