JSF : Better way to check for existence of <h:message for="id"/>

Posted by user552809 on Stack Overflow See other posts from Stack Overflow or by user552809
Published on 2010-12-23T21:29:15Z Indexed on 2010/12/23 21:54 UTC
Read the original article Hit count: 330

Filed under:
|

I have a form in which validation error message needs to be displayed below the input elements. The error needs to be highlighted by showing an error bubble around the error message and the input text.

To achieve this, I need to check for the existence of h:messages for individual elements. I am able to check for the existence of global error messages as follows

<h:panelGroup rendered="#{not empty facesContext.messages}"> 
</h:panelGroup>

How I can check the same for specific client id (say first name). So something like

faceContent.messages("creditCardNo")

A solution I have currently is to create a custom resolver but was wondering if there is a better solution.

© Stack Overflow or respective owner

Related posts about jsf

Related posts about jsf-2.0