baseaction.java
来自「Spring2.0宝典」· Java 代码 · 共 31 行
JAVA
31 行
/*
* Created on 2006-6-26
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.yeeku.webapp.action;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.opensymphony.webwork.ServletActionContext;
import com.opensymphony.xwork.ActionSupport;
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class BaseAction extends ActionSupport{
protected final Log log = LogFactory.getLog(getClass());
public Object getBean(String name) {
ApplicationContext ctx =
WebApplicationContextUtils.getRequiredWebApplicationContext(ServletActionContext.getServletContext());
return ctx.getBean(name);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?