本文整理汇总了Java中javax.faces.el.VariableResolver.resolveVariable方法的典型用法代码示例。如果您正苦于以下问题:Java VariableResolver.resolveVariable方法的具体用法?Java VariableResolver.resolveVariable怎么用?Java VariableResolver.resolveVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.el.VariableResolver
的用法示例。
在下文中一共展示了VariableResolver.resolveVariable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValue
import javax.faces.el.VariableResolver; //导入方法依赖的package包/类
@Override
public Object getValue(FacesContext context)
{
String varName;
int period = _expression.indexOf('.');
if (period < 0)
varName = _expression;
else
varName = _expression.substring(0, period);
VariableResolver vr = context.getApplication().getVariableResolver();
Object var = vr.resolveVariable(context, varName);
if (period < 0)
return var;
return _resolveProperty(context, var, _expression.substring(period + 1));
}
示例2: getInstance
import javax.faces.el.VariableResolver; //导入方法依赖的package包/类
public Object getInstance() throws InstantiationException
{
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext == null)
{
log.error("Object " + getManagedBeanName() + " cannot be created since the faces context is null");
return null;
}
Application application = facesContext.getApplication();
Object resolvedObject = null;
if (isVBExpression(getManagedBeanName()))
{
ValueBinding vb = application.createValueBinding(getManagedBeanName());
if (vb != null)
{
resolvedObject = vb.getValue(facesContext);
}
}
else
{
VariableResolver resolver = application.getVariableResolver();
resolvedObject = resolver.resolveVariable(facesContext, getManagedBeanName());
}
return resolvedObject;
}
示例3: getInstance
import javax.faces.el.VariableResolver; //导入方法依赖的package包/类
@Override
public Object getInstance() throws InstantiationException
{
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext == null)
{
log.error("Object " + getManagedBeanName() + " cannot be created since the faces context is null");
return null;
}
Application application = facesContext.getApplication();
Object resolvedObject = null;
if (isVBExpression(getManagedBeanName()))
{
ValueBinding vb = application.createValueBinding(getManagedBeanName());
if (vb != null)
{
resolvedObject = vb.getValue(facesContext);
}
}
else
{
VariableResolver resolver = application.getVariableResolver();
resolvedObject = resolver.resolveVariable(facesContext, getManagedBeanName());
}
return resolvedObject;
}
示例4: resolveManagedBean
import javax.faces.el.VariableResolver; //导入方法依赖的package包/类
/**
* Resolves a managed bean variable.
* @param managedBeanName the configured name of the managed bean
* @return the located object (can be null)
*/
public Object resolveManagedBean(String managedBeanName) {
Object oBean = null;
String sn = Val.chkStr(managedBeanName);
FacesContext fc = getFacesContext();
if ((sn.length() > 0) && (fc != null) && (fc.getApplication() != null)) {
VariableResolver resolver = fc.getApplication().getVariableResolver();
if (resolver != null) {
oBean = resolver.resolveVariable(fc,sn);
}
}
return oBean;
}
示例5: getCurrentInstance
import javax.faces.el.VariableResolver; //导入方法依赖的package包/类
/**
* Gets current instance of the controller.
* @return current instance of the controller
*/
public static LiveDataController getCurrentInstance() {
FacesContext fc = FacesContext.getCurrentInstance();
VariableResolver vr = fc.getApplication().getVariableResolver();
return (LiveDataController) vr.resolveVariable(fc, "LiveDataController");
}
示例6: getPage
import javax.faces.el.VariableResolver; //导入方法依赖的package包/类
/**
* ページオブジェクトを返す.
* @param pageName
* ページオブジェクト名
* @return ページオブジェクト
*/
public Page getPage(String pageName) {
VariableResolver resolver = context.getApplication().getVariableResolver();
return (Page) resolver.resolveVariable(context, pageName);
}