This content has been marked as final.
Show 3 replies
-
1. Re: Dynamic decoration, template bound to EL expression
sjmenden Sep 17, 2008 4:22 PM (in response to lseymore)You might have to do some extra digging on this one, I don't know off hand. The template attribute is defined as a TagAttribute in the DecorateHandler in facelets which the getValue looks like:
/** * If literal, then return our value, otherwise delegate to getObject, * passing String.class. * * @see #getObject(FaceletContext, Class) * @param ctx * FaceletContext to use * @return String value of this attribute */ public String getValue(FaceletContext ctx) { if (this.literal) { return this.value; } else { return (String) this.getObject(ctx, String.class); } }
so, if it is not a literal, Facelets treats it as a ValueExpression. So, from all appearances both "/editors/booleanEditor.xhtml" and #{seamHelper.getEditor(obj)}" should evaluate to the same String when the DecorateHandler tag invokes:
ctx.includeFacelet(parent, this.template.getValue(ctx));
I may be missing something, so I'd suggest joining the Facelets user mailing list, and posting there, they are quite responsive.
-
2. Re: Dynamic decoration, template bound to EL expression
lseymore Sep 18, 2008 10:59 AM (in response to lseymore)Thanks for your input Samuel, I believe you're on the right track here...
-
3. Re: Dynamic decoration, template bound to EL expression
lseymore Sep 18, 2008 11:39 AM (in response to lseymore)Hi,
I have resolved the error. Its my own fault for not reading the stack traces and not understanding Seam conversations well enough yet.
Tested the following:
<c:set var="obj" value="#{true}"/>
<ui:decorate template="#{seamHelper.getEditor(obj)}">
<ui:param name="binding" value="#{obj}"/>
</ui:decorate>
Checkboxes where generated...
<c:set var="obj" value="#{'Some string'}"/>
<ui:decorate template="#{seamHelper.getEditor(obj)}">
<ui:param name="binding" value="#{obj}"/>
</ui:decorate>
Textboxes where generated...
At least now everyone can use this concept to create generic editors ;)
Regards,
-L