A very simple JSF Validation example!

Here we go.
<!DOCTYPE html>
<html xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
    <title>Index</title>
</h:head>
<h:body>
    <h:form id="formvalidation" prependId="false">
        <h:inputText id="username"
                     value="#{userBean.username}" 
                     validatorMessage="Not good enough!">
            <f:validateLength minimum="5" maximum="10"/>
        </h:inputText>
        <br/>
        <h:commandButton value="Submit"/>
    </h:form>
    <h:messages id="messages"/>
</h:body>
</html>