baseaction.java

来自「工厂版本管理系统,STRUTS2框架,用于管理商品的版本,便于有效的控制版本」· Java 代码 · 共 37 行

JAVA
37
字号
package com.utstar.fcs.web.struts.action;

import javax.servlet.ServletContext;

import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.bluesky.common.domain.IReposity;
import com.opensymphony.xwork2.ActionSupport;
import com.utstar.fcs.service.IWorkInstructionService;

public class BaseAction extends ActionSupport {
	private Logger logger = Logger.getLogger(this.getClass());
	
	public BaseAction() {

	}

	private WebApplicationContext getWac() {
		ServletContext servletContext = ServletActionContext
				.getServletContext();

		return WebApplicationContextUtils
				.getRequiredWebApplicationContext(servletContext);
	}

	public IReposity getReposity() {
		return (IReposity) getWac().getBean("reposity");
	}
	
	public IWorkInstructionService getWorkInstructionService(){
		return (IWorkInstructionService) getWac().getBean("workInstructionService");
	}
}

⌨️ 快捷键说明

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