?? extendedaction.java
字號:
package com.emis.framework;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.Action;
import com.emis.util.Constants;
public abstract class ExtendedAction extends Action {
Log log=LogFactory.getLog(this.getClass());
/**
* 得到一個具體的業務代理實例
* @param factoryKey 具體某個工廠,可擴展
* @param serviceKey 某個業務的key
* @return
*/
protected IEmisActionProxy getService(String factoryKey,String serviceKey) {
//可以指定工廠類
IEmisFactory faction=(IEmisFactory)getApplicationObject(factoryKey);
IEmisActionProxy service=null;
try{
service=faction.createService(serviceKey);
}catch(Exception ex){
System.out.println("加載服務出現錯誤!!");
return null;
}
return service;
}
/**
* 默認加載EmisActionProxyFactory工廠
* @param serviceKey
* @return
*/
protected IEmisActionProxy getService(String serviceKey) {
return (this.getService(Constants.EMIS_FACTORY_KEY,serviceKey));
}
/**
*
* @param serviceFactoryKey
* @return
*這個方法通過key取出容器中的對象
*/
protected Object getApplicationObject(String key){
return servlet.getServletContext().getAttribute(key);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -