addToControlFromResourceBundle messages aren't <s:decorate>d
newlukai Jul 8, 2009 4:28 PMHi,
I'm using Seam 2.1.1.GA with ICEfaces 1.8.1 on a JBoss AS 5.1.0.GA and have a problem decorating invalid input fields.
The fields are decorated like this:
<ice:form id="editEntity"> <!-- some more fields here --> <s:decorate id="decorate_chnglistID" template="inc/decorateField.xhtml"> <h:inputText value="#{entity.chnglistID}" id="chnglistID" /> </s:decorate> </ice:form>
The inc/decorateField.xhtml is as follows:
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib"> <span class="#{invalid?'fieldFailed':''}"> <ui:insert /> </span> </ui:composition>
Examining the source code of the generated page shows me that the decorating works. The value class of the span tag is empty.
In the Seam component which is invoked by submitting this page calls FacesMessages.addToControlFromResourceBundle to display errors:
@Override protected boolean applyChanges() { try { otherComponent.validateEntity(entity); } catch (MissingPropertiesException e) { MessageMap map = MissingPropertyMessageMap.getInstance(); for(YTrackProperty property : e.getMissingProperties()) { facesMessages.addToControlFromResourceBundle(map.getID(property), Severity.WARN, map.getDetailMessage(property)); } return false; } catch (IllegalException e) { MessageMap map = IllegalStateMessageMap.getInstance(); for(YTrackProperty property : e.getIllegalProperties()) { facesMessages.addToControlFromResourceBundle(map.getID(property), Severity.ERROR, map.getDetailMessage(property)); } return false; } saveEntityAndProtocolChanges(); return true; }
As I already said the decoration works (remember that the span tag from the file inc/decorateField.xhtml is rendered). The problem now is, that in case of an invalid field (facesMessages.addToControlFromResourceBundle is called) the class attribute of the span tag doesn't change to fieldFailed
. It stays empty instead.
I already tried to specify the id of the control hardcoded (editEntity:decorate_chnglistID:chnglistID and chnglistID), but that didn't work. The call map.getID(property) returns chnglistID
, so this should work. What else can be wrong?
Thanks in advance
Jens