如果解决dwr整合struts中,spring的service注射问题?
最近项目扩展,想采用dwr,遇到个问题!还请各位帮忙!
因为原来的系统是stuts+spring,而且在基础action中封装了一些基础业务方法.
所以新增加的模块也想通过dwr+stuts+spring来做,不想让dwr直接和spring的service交互
所以准备该模块的主要流程还是通过action来做,然后将一些dwr需要交互的业务方法抽离出来放在action中
但是这样就存在一个问题,那就是dwr和action中的这些业务方法交互时,dwr是新建一个action类
那么struts初始化时,spring注入的service就为空!这样供dwr调用的方法中就没法操作service!
想请教下各位大峡又什么好的解决方法没?
以下是action的部分代码:
public class ExpertVoteAction extends BaseAction {public void setServlet(ActionServlet actionServlet) {super.setServlet(actionServlet);ServletContext servletContext = actionServlet.getServletContext();WebApplicationContext wac =WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);proService = (ProfInfoService)wac.getBean("profInfoService");}public ActionForward submit(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) {return mapping.findForward("index");}public List getAllPeople() { return proService.QueryData("2005"); }<bean id="AjaxDeptService" name="code"><dwr><allow> <create creator="spring" javascript="AjaxDeptService"> <param name="beanName" value="AjaxDeptService"/> <include method="sub_deploy"/> </create></allow></dwr>