當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。