當前位置: 首頁>>代碼示例>>Java>>正文


Java ValueExpression.setValue方法代碼示例

本文整理匯總了Java中javax.el.ValueExpression.setValue方法的典型用法代碼示例。如果您正苦於以下問題:Java ValueExpression.setValue方法的具體用法?Java ValueExpression.setValue怎麽用?Java ValueExpression.setValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.el.ValueExpression的用法示例。


在下文中一共展示了ValueExpression.setValue方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setValue

import javax.el.ValueExpression; //導入方法依賴的package包/類
@Override
public void setValue(EvaluationContext ctx, Object value)
        throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            expr.setValue(ctx.getELContext(), value);
            return;
        }
    }
    ctx.setPropertyResolved(false);
    ctx.getELResolver().setValue(ctx, null, this.image, value);
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled.null", this.image));
    }
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:19,代碼來源:AstIdentifier.java

示例2: testBug51177ObjectMap

import javax.el.ValueExpression; //導入方法依賴的package包/類
@Test
public void testBug51177ObjectMap() {
    ExpressionFactory factory = ExpressionFactory.newInstance();
    ELContext context = new ELContextImpl();

    Object o1 = "String value";
    Object o2 = Integer.valueOf(32);

    Map<Object,Object> map = new HashMap<Object,Object>();
    map.put("key1", o1);
    map.put("key2", o2);

    ValueExpression var =
        factory.createValueExpression(map, Map.class);
    context.getVariableMapper().setVariable("map", var);

    ValueExpression ve1 = factory.createValueExpression(
            context, "${map.key1}", Object.class);
    ve1.setValue(context, o2);
    assertEquals(o2, ve1.getValue(context));

    ValueExpression ve2 = factory.createValueExpression(
            context, "${map.key2}", Object.class);
    ve2.setValue(context, o1);
    assertEquals(o1, ve2.getValue(context));
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:27,代碼來源:TestValueExpressionImpl.java

示例3: testBug51177ObjectList

import javax.el.ValueExpression; //導入方法依賴的package包/類
@Test
public void testBug51177ObjectList() {
    ExpressionFactory factory = ExpressionFactory.newInstance();
    ELContext context = new ELContextImpl();

    Object o1 = "String value";
    Object o2 = Integer.valueOf(32);

    List<Object> list = new ArrayList<Object>();
    list.add(0, o1);
    list.add(1, o2);

    ValueExpression var =
        factory.createValueExpression(list, List.class);
    context.getVariableMapper().setVariable("list", var);

    ValueExpression ve1 = factory.createValueExpression(
            context, "${list[0]}", Object.class);
    ve1.setValue(context, o2);
    assertEquals(o2, ve1.getValue(context));

    ValueExpression ve2 = factory.createValueExpression(
            context, "${list[1]}", Object.class);
    ve2.setValue(context, o1);
    assertEquals(o1, ve2.getValue(context));
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:27,代碼來源:TestValueExpressionImpl.java

示例4: createComponent

import javax.el.ValueExpression; //導入方法依賴的package包/類
/**
 * When within a component binding context, the component bindings (stored in backing bean)
 * will be cleared so a new component instance can be created.
 * @param context FacesContext instance
 * @param newId id for the component
 */
@Override
protected UIComponent createComponent(FacesContext context, String newId)
  throws JspException
{
  UIComponent component = null;
  if (RequestContext.isInComponentBindingContext(context) && hasBinding())
  {
   // null out component in binding; this forces a new component to be created.
   ValueExpression binding = _getBinding();
   binding.setValue(getELContext(), null);
  }

  component = super.createComponent(context, newId);
  // if the component was pulled out of a component binding during createComponent() it is likely
  // to be attached to some component in the tree - and thus the (severe) error is justified
  if (component != null && component.getParent() != null)
    _logStaleParent(context, component, component.getParent());

  return component;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:27,代碼來源:UIXComponentELTag.java

示例5: setValue

import javax.el.ValueExpression; //導入方法依賴的package包/類
@Override
public void setValue(EvaluationContext ctx, Object value) throws ELException {
	VariableMapper varMapper = ctx.getVariableMapper();
	if (varMapper != null) {
		ValueExpression expr = varMapper.resolveVariable(this.image);
		if (expr != null) {
			expr.setValue(ctx.getELContext(), value);
			return;
		}
	}
	ctx.setPropertyResolved(false);
	ctx.getELResolver().setValue(ctx, null, this.image, value);
	if (!ctx.isPropertyResolved()) {
		throw new PropertyNotFoundException(MessageFactory.get("error.resolver.unhandled.null", this.image));
	}
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:17,代碼來源:AstIdentifier.java

示例6: _executeBindings

import javax.el.ValueExpression; //導入方法依賴的package包/類
/**
 * Execute any "binding" attributes so that a popped view
 * is properly set up
 */
@SuppressWarnings("unchecked")
private void _executeBindings(FacesContext context, UIComponent component)
{
  ValueExpression expression = component.getValueExpression("binding");
  if (expression != null)
    expression.setValue(context.getELContext(), component);

  Iterator<UIComponent> kids = component.getFacetsAndChildren();
  while (kids.hasNext())
    _executeBindings(context, kids.next());
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:16,代碼來源:DialogServiceImpl.java

示例7: processAction

import javax.el.ValueExpression; //導入方法依賴的package包/類
/**
 * Gets the value from the "from" property and sets it on 
 * the ValueBinding for the "to" property
 */
public void processAction(ActionEvent event)
{
  ValueExpression to = _bean.getValueExpression(Bean.TO_KEY);
  if (to != null)
  {
    Object from = getFrom();
    try
    {
      to.setValue(FacesContext.getCurrentInstance().getELContext(), from);
    }
    catch (RuntimeException e)
    {
      if (_LOG.isWarning())
      {
        ValueExpression fromExpression = _bean.getValueExpression(Bean.FROM_KEY);
        String mes = "Error setting:'"+to.getExpressionString() +
          "' to value:"+from;
        if (fromExpression != null)
          mes += " from:'"+fromExpression.getExpressionString()+"'";
          
        _LOG.warning(mes, e);
      }
      throw e;
    }
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:31,代碼來源:SetActionListener.java

示例8: setValue

import javax.el.ValueExpression; //導入方法依賴的package包/類
public void setValue(EvaluationContext ctx, Object value)
        throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            expr.setValue(ctx.getELContext(), value);
            return;
        }
    }
    ctx.setPropertyResolved(false);
    ctx.getELResolver().setValue(ctx, null, this.image, value);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:AstIdentifier.java

示例9: updateModel

import javax.el.ValueExpression; //導入方法依賴的package包/類
public void updateModel(FacesContext context)
{
  if (context == null)
    throw new NullPointerException();

  if (!isValid() || !isLocalValueSet())
    return;

  ValueExpression expression = getFacesBean().getValueExpression(VALUE_KEY);
  if (expression == null)
    return;

  try
  {
    Object localValue = getLocalValue();
    expression.setValue(context.getELContext(), localValue);
    setValue(null);
    setLocalValueSet(false);
    (new ValueUpdatedEvent(this)).queue();
    if (_LOG.isFiner())
    {
      _LOG.finer("Wrote value {0} to model {1} in component {2}",
                 new Object[]{localValue,
                              expression.getExpressionString(),
                              this});
    }
  }
  catch (RuntimeException e)
  {
    // exceptions at this point can occur during normal
    // bean attribute level validation:
    if (_LOG.isFine())
    {
      _LOG.fine("Error updating expression ({0})",
                  expression.getExpressionString());
      _LOG.fine(e);
    }

    setValid(false);

    // don't report the exception if the exception is a Reportable instance and tells so
    boolean shouldReportMessage = (e instanceof Reportable) ?
                                  ((Reportable) e).shouldReportMessage() :
                                  true;

    if (shouldReportMessage)
    {
      FacesMessage message = MessageFactory.getMessage(e);
      message = _wrapMessage(message);
      context.addMessage(getClientId(context), message);
    }
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:54,代碼來源:UIXEditableValueTemplate.java


注:本文中的javax.el.ValueExpression.setValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。