The default message icon corresponds to the component's client ID, exactly the same as you can see in the generated HTML output via rightclick, View Source. This j_id7 in this particular case is the client identifier of the parent <form> element. If you provide the JSF component with a fixed ID, for example, <h:form id="login"> , then the labels will become login:UserId and login:Password respectively.
However, you can use the attribute of the input component label to completely redefine it so that the message label appears exactly as you intended.
<h:inputText ... label="User ID" /> <h:inputSecret ... label="Password" />
If an attribute of the input component label present, it will be used instead of the client identifier. Using prependId="false" , as suggested by other answers, has disadvantages . Do not do that.
Alternatively, you can use the requiredMessage attribute (either converterMessage or validatorMessage ), but this does not allow you to parameterize messages and, therefore, you will have to hardcode the labels, etc.
<h:inputText ... label="User ID is required." /> <h:inputSecret ... label="Password is required." />
See also:
It is noted that it is really inconvenient for the labels to be duplicated as follows:
<h:outputLabel for="userId" value="User ID" ... /> <h:inputText id="userId" ... label="User ID" /> <h:outputLabel for="password" value="Password" ... /> <h:inputSecret id="password" ... label="Password" />
If you use the JSF OmniFaces utility library , you can use <o:outputLabel> so that JSF transparently sets the label attribute of the associated component:
<o:outputLabel for="userId" value="User ID" ... /> <h:inputText id="userId" ... /> <o:outputLabel for="password" value="Password" ... /> <h:inputSecret id="password" ... />