basedispatchaction.java

来自「jaguey,网上的一个朋友给我的」· Java 代码 · 共 76 行

JAVA
76
字号
package net.javapassion.jaguey.web.action;

import javax.servlet.ServletContext;
import org.apache.struts.actions.DispatchAction;
import org.apache.struts.action.ActionServlet;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import net.javapassion.jaguey.service.*;

//版本: JagueyBBS 1.1
//功能: 注射业务逻辑实例
//作者: 赵程佳
//时间: 2006-02-13 20:17:39

public class BaseDispatchAction extends DispatchAction {
	private WebApplicationContext webApplicationContext;
	
	public void setServlet(ActionServlet actionServlet) {
		super.setServlet(actionServlet);
        ServletContext servletContext = actionServlet.getServletContext();
        webApplicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
	}
	
	protected AssortOper getAssortOper() {
	    return (AssortOper) webApplicationContext.getBean("assortOper");
	}
	
	protected BoardOper getBoardOper() {
		return (BoardOper) webApplicationContext.getBean("boardOper");
	}
	
	protected CollTopicOper getCollTopicOper() {
		return (CollTopicOper) webApplicationContext.getBean("collTopicOper");
	}
	
	protected FriendUserOper getFriendUserOper() {
		return (FriendUserOper) webApplicationContext.getBean("friendUserOper");
	}
	
	protected InfoBoxOper getInfoBoxOper() {
		return (InfoBoxOper) webApplicationContext.getBean("infoBoxOper");
	}
	
	protected LinkOper getLinkOper() {
		return (LinkOper) webApplicationContext.getBean("linkOper");
	}
	
	protected NoteMessOper getNoteMessOper() {
		return (NoteMessOper) webApplicationContext.getBean("noteMessOper");
	}
	
	protected OnlineOper getOnlineOper() {
		return (OnlineOper) webApplicationContext.getBean("onlineOper");
	}
	
	protected RevertOper getRevertOper() {
		return (RevertOper) webApplicationContext.getBean("revertOper");
	}
	
	protected TopicOper getTopicOper() {
		return (TopicOper) webApplicationContext.getBean("topicOper");
	}
	
	protected TopicTypeOper getTopicTypeOper() {
		return (TopicTypeOper) webApplicationContext.getBean("topicTypeOper");
	}
	
	protected UserInfoOper getUserInfoOper() {
		return (UserInfoOper) webApplicationContext.getBean("userInfoOper");
	}
	
	protected UserRoleOper getUserRoleOper() {
		return (UserRoleOper) webApplicationContext.getBean("userRoleOper");
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?