大家好,
我用Struts+Spring +Hibernate 整和框架, 将 Struts 的 action 交由 Spring 管理了,
但是我在 Action中使用 this.getServlet().getServletConfig()获取servletConfig 却出现空指针异常,
怎么都想不通?
(
我使用jspsmartupload上传控件, 在Action 中初始化SmartUpload 对象
SmartUpload su = new SmartUpload();
su.initialize(this.getServlet().getServletConfig(), request, response);
)
[b]问题补充:[/b]
3位兄弟的回答都不是我要问的,
使用 jspsmartupload 上传,首先需要初始化smartupload对象,在jsp中使用,使用 :pageContext参数来初始化
[code="java"]
SmartUpload su = new SmartUpload();
su.initialize(pageContext);
[/code]
但是,在action 中,只能使用它的另一个初始化方法:(action中无法获取pageContext)
[code="java"]
su.initialize(this.getServlet().getServletConfig(), request, response);
[/code]
现在,action交由 Spring 托管了,结果却无法使用 this.getServlet()来获取servlet了........
有什么方法可以解决啊???????