Sun Java System Application Server Platform Edition 9 リリースノート

解決方法

式の解決を「以前」の VariableResolver に委任するのではなく、ValueExpression を作成して、これを評価することをお勧めします。


例 3–1 ValueExpression の評価

public class CustomVR extends VariableResolver {

    private VariableResolver previous = null;

    public CustomVR(VariableResolver previous) {
	this.previous = previous;
    }
  
    public Object resolveVariable(FacesContext context, String name)
	throws EvaluationException {
	Object result = null;
	
	// Do some action that may resolve the variable.  If not, you
	// may be tempted to simply do: 

	// result = previous.resolveVariable(context, name);

	// But this would not work due to bug 6419278.  A fix is
	// available, please see the Release Notes.  However, a
	// workaround is the following.

	ValueExpression ve = context.getApplication().getExpressionFactory(). \
createValueExpression(context.getELContext(), "#{" + name + "}", Object.class);
	try {
	    result = ve.getValue(context.getELContext());
	}
	catch (PropertyNotFoundException pnfe) {
	    throw new EvaluationException(pnfe);
	}
	catch (ELException ele) {
	    throw new EvaluationException(ele);
	}
	return result;

    }
}