📄 baseaction.java
字号:
package limq.struts.action;
import javax.servlet.ServletContext;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionServlet;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import limq.spring.service.*;
abstract class BaseAction extends Action {
private IStudentsService studentsService;
private ITeachersService teachersSerivce;
private IAdminService adminService;
public void setServlet(ActionServlet actionServlet) {
super.setServlet(actionServlet);
ServletContext servletContext = actionServlet.getServletContext();
WebApplicationContext wac = WebApplicationContextUtils
.getRequiredWebApplicationContext(servletContext);
this.studentsService = (IStudentsService) wac.getBean("studentManager");
this.adminService = (IAdminService) wac.getBean("adminManager");
this.teachersSerivce = (ITeachersService) wac.getBean("teacherManager");
}
public IStudentsService getStudentsService() {
return studentsService;
}
public ITeachersService getTeachersSerivce() {
return teachersSerivce;
}
public void setTeachersSerivce(ITeachersService teachersSerivce) {
this.teachersSerivce = teachersSerivce;
}
public IAdminService getAdminService() {
return adminService;
}
public void setAdminService(IAdminService adminService) {
this.adminService = adminService;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -