I have this ice faces component with validator:
<ice:inputText id="#{id}" value="#{bean[field]}" required="#{required}"
rendered="#{rendered}" styleClass="#{inputCssStyle}">
<f:validator validatorId="#{validatorId}" />
</ice:inputText>
<br />
<ice:message style="color: red;" id="ageError" for="#{id}" />
As you see, I do want ice:message to be rendered under the input text so I put a < br /> tag. The problem is that if there is no error the br tag will still be there and I do not want that...
Do you see how can I check if there is an error for this field (wit开发者_Python百科hout using a property from the validator bean) directly in the xhtml page...?
Thanks.
You should use css for that: display: block;
, no need for the br tag.
<ice:message style="color: red; display: block;" id="ageError" for="#{id}" />
<ice:panelGroup>
<ice:inputText id="#{id}" value="#{bean[field]}" required="#{required}"
rendered="#{rendered}" styleClass="#{inputCssStyle}">
<f:validator validatorId="#{validatorId}" />
</ice:inputText>
<ice:panelGroup>
<ice:message style="color: red;" id="ageError" for="#{id}" />
精彩评论