本文整理汇总了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);
}