Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* 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;
DelegatingVariableResolver, a seasar2 bean variable resolver.

It defines a variable called _container to represent the instance of org.seasar.framework.container.S2Container. The _container is get from SingletonS2ContainerFactory.getContainer().

Usage:
in your zul file:
<?variable-resolver class="org.zkoss.zkplus.seasar.DelegatingVariableResolver"?>

Author(s):
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(==null){
			 = SingletonS2ContainerFactory.getContainer();
		}
		if(!=null){
			try{
				return .getComponent(name);
			}catch(ComponentNotFoundRuntimeException ex){
				//do nothing.
			}
		}
		return null;
	}
New to GrepCode? Check out our FAQ X