basebean.java

来自「这是一些关于JSF实例的源代码,很难得的,对学习Web页面编程很有帮助」· Java 代码 · 共 47 行

JAVA
47
字号
/*
 * JCatalog Project
 */
package catalog.view.bean;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
//
import catalog.view.servicelocator.ServiceLocator;

/**
 * @author <a href="mailto:derek_shen@hotmail.com">Derek Y. Shen</a>
 */
public class BaseBean {
	//the logger for this class
	protected final Log logger = LogFactory.getLog(this.getClass());
	
	//the service locator of the business services
	protected ServiceLocator serviceLocator;
	
	public BaseBean() {
	}
	
	public ServiceLocator getServiceLocator() {
		return this.serviceLocator;
	}
	
	public void setServiceLocator(ServiceLocator newServiceLocator) {
		this.logger.debug("service locator is set");
		this.serviceLocator = newServiceLocator;
		
		this.init();
	}
	
	/**
	 * Used to initialize the managed bean.
	 * <p>
	 * Called after the service locator is set.
	 * It is a workaround.
	 * <p>
	 * Once the JSF bean management facility can support init method,
	 * the init method can be configured and called from the JSF implementation directly.
	 */ 
	protected void init() {
	}
}

⌨️ 快捷键说明

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