Using forceId with facelets
Recently JSF project that I am working on was shifted from JSP to facelets.
It was really easy task, but nevertheless several problems arose during migration. One of them – using forceId with some myfaces components. The problem is that facelets uses JSF component classes as beans, but forceId is not a java property of tomahawk components. Instead it is passed as JSF attribute and this is handled somewhere is JSP tag classes that are not used by facelets. Of course this can be solved by writing custom TagHandler (analogous of JSP Tag class), but it would be too much work – write TagHandler for every myfaces component.
Much easier solution exists – use f:attribute like this:
<t:outputText id="myd" value="#{bean.property}">
<f:attribute name="forceId" value="true"/>
</t:outputText>
Posted by on May 22, 2006 | development, java, jsf
Comments
Jubz October 10, 2007 at 9:23 p.m.
Thanks a lot. Wish they had it as a straight attribute (e.g. forceId="true" within each element.
Christopher Hlubek October 26, 2006 at 5:31 p.m.
Thank you, works wondeful!