⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 delegatingvariableresolver.java

📁 ZK 基础介绍 功能操作 模块 结合数据库操作
💻 JAVA
字号:
/* DelegatingVariableResolver.java

{{IS_NOTE
	Purpose:
		
	Description:
		
	History:
		Aug 2 12:12:33 2007, Created by Dennis Chen
}}IS_NOTE

Copyright (C) 2007 Potix Corporation. All Rights Reserved.

{{IS_RIGHT
}}IS_RIGHT
*/
package org.zkoss.zkplus.seasar;

import org.seasar.framework.container.ComponentNotFoundRuntimeException;
import org.seasar.framework.container.S2Container;
import org.seasar.framework.container.factory.SingletonS2ContainerFactory;
import org.zkoss.xel.VariableResolver;

/**
 * DelegatingVariableResolver, a seasar2 bean variable resolver.
 *
 * <p>It defines a variable called <code>_container</code> to represent
 * the instance of <code>org.seasar.framework.container.S2Container</code>.
 * The _container is get from <code>SingletonS2ContainerFactory.getContainer()</code>.
 *
 * <p>Usage:<br/>
 * 
 * in your zul file:<br/>
 * <code>&lt;?variable-resolver class="org.zkoss.zkplus.seasar.DelegatingVariableResolver"?&gt;</code>
 *
 * @author Dennis.Chen
 * @since 3.0.0
 */
public class DelegatingVariableResolver implements VariableResolver {
	protected S2Container _container;
	/**
	 * Get the seasar component by the specified name.
	 */		
	public Object resolveVariable(String name) {
		if(_container==null){
			_container = SingletonS2ContainerFactory.getContainer();
		}
		if(_container!=null){
			try{
				return _container.getComponent(name);
			}catch(ComponentNotFoundRuntimeException ex){
				//do nothing.
			}
		}
		return null;
	}
}

⌨️ 快捷键说明

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