You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2007/08/16 22:01:47 UTC
svn commit: r566815 -
/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java
Author: bommel
Date: Thu Aug 16 13:01:46 2007
New Revision: 566815
URL: http://svn.apache.org/viewvc?view=rev&rev=566815
Log:
(TOBAGO-466) Extend AttributeHandler for handling methodexpression in a facelet composition
Modified:
myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java
Modified: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java?view=diff&rev=566815&r1=566814&r2=566815
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java (original)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java Thu Aug 16 13:01:46 2007
@@ -21,7 +21,6 @@
import javax.el.MethodExpression;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
-import javax.el.PropertyNotFoundException;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.component.EditableValueHolder;
@@ -125,22 +124,14 @@
}
private MethodExpression getMethodExpression(FaceletContext faceletContext, Class returnType, Class[] args) {
- // in a composition may be we get the method expression from a value expression
- // the method expression can be empty
+ // in a composition may be we get the method expression string from the current variable mapper
+ // the expression can be empty
// in this case return nothing
- if (value.getValue().startsWith("$")) {
- try {
- Object obj = value.getValueExpression(faceletContext, String.class).getValue(faceletContext);
- if (obj != null && obj instanceof String && ((String) obj).length() > 0) {
- ExpressionFactory expressionFactory = faceletContext.getExpressionFactory();
- return expressionFactory.createMethodExpression(faceletContext, (String) obj, returnType, args);
- }
- } catch (PropertyNotFoundException e) {
- // ignore asume
+ if (value.getValue().startsWith("${")) {
+ String myValue = value.getValue().replaceAll("(\\$\\{)|(\\})", "");
+ ValueExpression expression = faceletContext.getVariableMapper().resolveVariable(myValue);
+ if (expression != null) {
ExpressionFactory expressionFactory = faceletContext.getExpressionFactory();
- String myValue = value.getValue().replaceAll("(\\$\\{)|(\\})", "");
- ValueExpression expression = faceletContext.getVariableMapper().resolveVariable(myValue);
-
return new TagMethodExpression(value, expressionFactory.createMethodExpression(faceletContext,
expression.getExpressionString(), returnType, args));
}