当前位置: 首页>>代码示例>>Java>>正文


Java FacesContext.getELContext方法代码示例

本文整理汇总了Java中javax.faces.context.FacesContext.getELContext方法的典型用法代码示例。如果您正苦于以下问题:Java FacesContext.getELContext方法的具体用法?Java FacesContext.getELContext怎么用?Java FacesContext.getELContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.faces.context.FacesContext的用法示例。


在下文中一共展示了FacesContext.getELContext方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionListener

import javax.faces.context.FacesContext; //导入方法依赖的package包/类
public void actionListener(ActionEvent event)
{
  String value = _actionListener;
  if (value != null)
  {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExpressionFactory expressionFactory =
        facesContext.getApplication().getExpressionFactory();
    ELContext context = facesContext.getELContext();

    MethodExpression methodExpression =
        expressionFactory.createMethodExpression(context, value, Void.TYPE,
            new Class<?>[]
            { ActionEvent.class });
    methodExpression.invoke(context, new Object[]
    { event });
  }

}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:20,代码来源:ImmutableItemNode.java

示例2: doAction

import javax.faces.context.FacesContext; //导入方法依赖的package包/类
public String doAction()
{
  String value = _action;

  if (value != null)
  {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExpressionFactory expressionFactory =
        facesContext.getApplication().getExpressionFactory();
    ELContext context = facesContext.getELContext();
    MethodExpression methodExpression =
        expressionFactory.createMethodExpression(context, value,
            String.class, new Class<?>[]
            {});
    value = (String) methodExpression.invoke(context, null);
  }

  // Post me as the selected Node for the request
  postSelectedNode(this);

  return value;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:23,代码来源:ImmutableItemNode.java

示例3: doAction

import javax.faces.context.FacesContext; //导入方法依赖的package包/类
/**
  * Gets the value of the node's action property.  The action attr value
  * could be one of 2 things:
  * 1) An EL expression
  * 2) An outcome referencing a navigation rule in the faces_config file.
  * 
  * Since this method is called only when an ItemNode is clicked, the model 
  * is notified that this node is the currently selected node.
  * 
  * @return String value of the ItemNode's "action" property.
  */
@Override
public String doAction()
{
  String value = _action;

  if (value != null)
  {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExpressionFactory expressionFactory =
        facesContext.getApplication().getExpressionFactory();
    ELContext context = facesContext.getELContext();
    MethodExpression methodExpression =
        expressionFactory.createMethodExpression(context, value,
            String.class, new Class<?>[]
            {});
    value = (String) methodExpression.invoke(context, null);
  }

  // Post me as the selected Node for the request
  postSelectedNode(this);

  return value;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:35,代码来源:ItemNode.java

示例4: actionListener

import javax.faces.context.FacesContext; //导入方法依赖的package包/类
public void actionListener(ActionEvent event)
{
  String value = _actionListener;
  if (value != null)
  {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExpressionFactory expressionFactory =
        facesContext.getApplication().getExpressionFactory();
    ELContext context = facesContext.getELContext();

    MethodExpression methodExpression =
        expressionFactory.createMethodExpression(context, value, Void.TYPE,
            new Class<?>[]
            { ActionEvent.class });
    methodExpression.invoke(context, new Object[]{ event });
  }

}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:19,代码来源:ItemNode.java

示例5: _getELContext

import javax.faces.context.FacesContext; //导入方法依赖的package包/类
private static ELContext _getELContext(Application application)
{
  FacesContext fContext = FacesContext.getCurrentInstance();

  if (fContext != null)
  {
    return fContext.getELContext();
  }
  else
  {
    // use a dummy ELContext if FacesContext is null
    return new MockELContext(application);
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:15,代码来源:LazyValueExpression.java

示例6: _getELContext

import javax.faces.context.FacesContext; //导入方法依赖的package包/类
static private ELContext _getELContext(
  FacesContext context, ELResolver resolver)
{
  // Hopefully, we have a FacesContext.  If not, we're
  // going to have to synthesize one!
  if (context != null)
    return context.getELContext();

  return new ELContextImpl(resolver);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:11,代码来源:SortableModel.java

示例7: unsafeEL

import javax.faces.context.FacesContext; //导入方法依赖的package包/类
public void unsafeEL(String expression) {
    FacesContext context = FacesContext.getCurrentInstance();
    ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
    ELContext elContext = context.getELContext();
    ValueExpression vex = expressionFactory.createValueExpression(elContext, expression, String.class);
    String result = (String) vex.getValue(elContext);
    System.out.println(result);
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:9,代码来源:ElExpressionSample.java

示例8: safeEL

import javax.faces.context.FacesContext; //导入方法依赖的package包/类
public void safeEL() {
    FacesContext context = FacesContext.getCurrentInstance();
    ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
    ELContext elContext = context.getELContext();
    ValueExpression vex = expressionFactory.createValueExpression(elContext, "1+1", String.class);
    String result = (String) vex.getValue(elContext);
    System.out.println(result);
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:9,代码来源:ElExpressionSample.java


注:本文中的javax.faces.context.FacesContext.getELContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。