JSF Message Example
The JSF Message tag help us to displays an error message to the UI component if a validation or conversion error occurred to that component. The value of the ‘for’ attribute in h:message should bound to ‘id’ of the UI component. Below is an example of h:message
JSF h:message Example
The below JSF page has a h:Message and two h:inputText components. The required attribute is set to true for the input components. The h:message display an error message if the form is submitted with blank values in the input components.
<h:message for="username" style="color:red;" />
Username: <h:inputText label="username" id="username" required="true"/><br/>
<h:message for="password" style="color:red;" />
Password: <h:inputSecret label="password" id="password" required="true"/><br/>
<h:commandButton value="Submit" type="submit"/>
Below is how the page look likes in browser
The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.
Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
Latest posts by Govind
- Is it possible to logout Primavera P6 through SQL Query? - February 16, 2018
- How to Create Primavera P6 EPPM Database schemas in Microsoft SQL Server - February 15, 2018
- Configure Windows Firewall for Microsoft SQL Server 2017 – Part 4 - February 14, 2018