Index: shale-validator/src/main/java/org/apache/shale/validator/faces/ValidatorScript.java =================================================================== --- shale-validator/src/main/java/org/apache/shale/validator/faces/ValidatorScript.java (revision 453789) +++ shale-validator/src/main/java/org/apache/shale/validator/faces/ValidatorScript.java (working copy) @@ -570,7 +570,7 @@ } } else { if (value != null && value instanceof String - && UIComponentTag.isValueReference((String) e.getValue())) { + && isValueReference((String) e.getValue())) { value = tagUtils.eval((String) e.getValue()); } @@ -652,4 +652,22 @@ writeValidationFunctions(writer, context); writeScriptEnd(writer); } + + /** + * Return true if the specified string contains an EL expression. + *

+ * This is taken almost verbatim from {@link javax.faces.webapp.UIComponentTag} + * in order to remove JSP dependencies from the renderers. + */ + private static boolean isValueReference(String value) + { + if (value == null) return false; + + int start = value.indexOf("#{"); + if (start < 0) return false; + + int end = value.lastIndexOf('}'); + return (end >=0 && start < end); + } + } Index: shale-validator/src/main/java/org/apache/shale/validator/faces/ValidatorInputRenderer.java =================================================================== --- shale-validator/src/main/java/org/apache/shale/validator/faces/ValidatorInputRenderer.java (revision 453789) +++ shale-validator/src/main/java/org/apache/shale/validator/faces/ValidatorInputRenderer.java (working copy) @@ -139,7 +139,7 @@ Map.Entry e = (Map.Entry) vi.next(); // only override if the var contains a value binding expression if (e.getValue() != null && e.getValue() instanceof String - && UIComponentTag.isValueReference((String) e.getValue())) { + && isValueReference((String) e.getValue())) { localVars.put(e.getKey(), tagUtils.eval((String) e.getValue())); @@ -179,5 +179,20 @@ return defaultRenderer.getRendersChildren(); } + /** + * Return true if the specified string contains an EL expression. + *

+ * This is taken almost verbatim from {@link javax.faces.webapp.UIComponentTag} + * in order to remove JSP dependencies from the renderers. + */ + private static boolean isValueReference(String value) + { + if (value == null) return false; + int start = value.indexOf("#{"); + if (start < 0) return false; + + int end = value.lastIndexOf('}'); + return (end >=0 && start < end); + } } Index: shale-core/src/main/java/org/apache/shale/util/Tags.java =================================================================== --- shale-core/src/main/java/org/apache/shale/util/Tags.java (revision 453789) +++ shale-core/src/main/java/org/apache/shale/util/Tags.java (working copy) @@ -62,7 +62,7 @@ if (attributeValue == null) { return; } - if (UIComponentTag.isValueReference(attributeValue)) { + if (isValueReference(attributeValue)) { setValueBinding(component, attributeName, attributeValue); } else { component.getAttributes().put(attributeName, attributeValue); @@ -88,7 +88,7 @@ if (attributeValue == null) { return; } - if (UIComponentTag.isValueReference(attributeValue)) { + if (isValueReference(attributeValue)) { setValueBinding(component, attributeName, attributeValue); } else { component.getAttributes().put(attributeName, @@ -115,7 +115,7 @@ if (attributeValue == null) { return; } - if (UIComponentTag.isValueReference(attributeValue)) { + if (isValueReference(attributeValue)) { setValueBinding(component, attributeName, attributeValue); } else { component.getAttributes().put(attributeName, @@ -142,7 +142,7 @@ if (attributeValue == null) { return; } - if (UIComponentTag.isValueReference(attributeValue)) { + if (isValueReference(attributeValue)) { setValueBinding(component, attributeName, attributeValue); } else { component.getAttributes().put(attributeName, @@ -229,7 +229,7 @@ if (attributeValue == null) { return; } - if (UIComponentTag.isValueReference(attributeValue)) { + if (isValueReference(attributeValue)) { setMethodBinding(component, "action", attributeValue, new Class[] {}); } else { @@ -260,7 +260,7 @@ if (attributeValue == null) { return; } - if (UIComponentTag.isValueReference(attributeValue)) { + if (isValueReference(attributeValue)) { FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); MethodBinding mb = app.createMethodBinding(attributeValue, paramTypes); @@ -280,7 +280,7 @@ if (expression == null) { return null; } - if (UIComponentTag.isValueReference(expression)) { + if (isValueReference(expression)) { FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); return app.createValueBinding(expression).getValue(context); @@ -301,7 +301,7 @@ if (expression == null) { return null; } - if (UIComponentTag.isValueReference(expression)) { + if (isValueReference(expression)) { FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); return "" + app.createValueBinding(expression).getValue(context); @@ -320,7 +320,7 @@ if (expression == null) { return null; } - if (UIComponentTag.isValueReference(expression)) { + if (isValueReference(expression)) { FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); Object r = app.createValueBinding(expression).getValue(context); @@ -346,7 +346,7 @@ if (expression == null) { return null; } - if (UIComponentTag.isValueReference(expression)) { + if (isValueReference(expression)) { FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); Object r = app.createValueBinding(expression).getValue(context); @@ -372,7 +372,7 @@ if (expression == null) { return null; } - if (UIComponentTag.isValueReference(expression)) { + if (isValueReference(expression)) { FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); Object r = app.createValueBinding(expression).getValue(context); @@ -405,4 +405,20 @@ public Class getType(FacesContext context) { return String.class; } } -} + /** + * Return true if the specified string contains an EL expression. + *

+ * This is taken almost verbatim from {@link javax.faces.webapp.UIComponentTag} + * in order to remove JSP dependencies from the renderers. + */ + private static boolean isValueReference(String value) + { + if (value == null) return false; + + int start = value.indexOf("#{"); + if (start < 0) return false; + + int end = value.lastIndexOf('}'); + return (end >=0 && start < end); + } +} \ No newline at end of file