本文整理匯總了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 });
}
}
示例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;
}
示例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;
}
示例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 });
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}