I'd like to display an error next to the fields that are wrong. I have that code for my page :

```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/WEB-INF/templates/basic.xhtml">
    <ui:define name="content">
        <h:form>
            <h:panelGrid columns="3">
                <h:outputText value="Firstname"/>
                <h:inputText id="firstName" value="#{account.firstName}" required="true">
                    <f:validator validatorId="stringAlphaValidator"/>
                </h:inputText>
                <h:message for="firstName" errorStyle="color:red; display:block"/>
                <h:outputText value="Lastname"/>
                <h:inputText id="lastName" value="#{account.lastName}" required="true">
                    <f:validator validatorId="stringAlphaValidator"/>
                </h:inputText>
                <h:message for="lastName" errorStyle="color:red; display:block"/>
                <h:outputText value="Login"/>
                <h:inputText id="login" value="#{account.login}" required="true">
                    <f:validator validatorId="stringAlphaValidator"/>
                </h:inputText>
                <h:message for="login" errorStyle="color:red; display:block"/>
                <h:outputText value="Password"/>
                <h:inputText id="password" value="#{account.password}" required="true">
                </h:inputText>
                <h:message for="password" errorStyle="color:red; display:block"/>
                <h:outputText value="Address"/>
                <h:inputText id="address" value="#{account.address}" required="true">
                    <f:validator validatorId="stringAlphaNumericValidator"/>
                </h:inputText>
                <h:message for="address" errorStyle="color:red; display:block"/>
                <h:outputText value="Email"/>
                <h:inputText id="email" value="#{account.email}" required="true">
                    <f:validator validatorId="emailAddressValidator"/>
                </h:inputText>
                <h:message for="email" errorStyle="color:red; display:block"/>
            </h:panelGrid>
            <h:commandButton value="Register"/>
            <h:messages globalOnly="true"/>
        </h:form>
    </ui:define>
</ui:composition>
</html>

```

If a field is empty and I press the `Register` button, I get that (here all fields are empty):

![Error while empty fields](https://i.stack.imgur.com/Z15Ec.png)

(sorry the error is in french. I don't know if it comes from my eclipse language or my tomcat server)

I didn't write this ! This is a text that my program writes on it's own somehow... How do I remove this ?

Also, this is a register page, I'd like to add to my DB the user (if the fields are right) and then change of page with the action `login`. How can I call a method to do that before it changes of page ?

If you need to see more code, like the validator classes, I can add it.