Reset Error Messages JSF with Reset Button and Clear Fields

I have a registration form with the following data:

First Name Last Name Age Email address Tel Number password re enter password.

Now if the passwords dont match or the age is a text error messages are show, i have a reset button to clear all the fields, but after the error comes up the resent button doesnt clear the messages or the fields.

Here is the code for the Button and whats in my java class:

<h:commandButton value="Reset" type="reset" action="#{javaBeanTest.reset()} />

In the Bean Class:

public void reset()
    this.foreName = null;
    this.surname = null;
    this.age = 0;
    this.password = null;
    this.confirmPass = null; = null;

How would i go about this? The Fields gets set to blank but messages remain


Try to use render="@form" in your command button, it will update the form and errors in it. What are you using for showing errormessages?

Try this way:

<h:commandButton value="Reset" action="#{javaBeanTest.reset()} />    
    <f:ajax render="@form"/>

Need Your Help

Moment.js: Date between dates

javascript date momentjs

I'm trying to detect with Moment.js if a given date is between two dates. Since version 2.0.0, Tim added isBefore() and isAfter() for date comparison.