Client Side Validation
JavaServer Faces (JSF)
Forms validation on the client-side is essential -- it saves time and bandwidth, and gives you more options to point out to the user where they've gone wrong in filling out the form. Furthermore, the browser doesn't have to make a round-trip to the server to perform routine client-side tasks. For example, you wouldn't want to send the browser to the server to validate that all of the required fields on a form were filled out.
If user forgets to provide name and/or enters a negative value, a message would be displayed to the user that indicates what was went wrong? However, if user conforms to requirements, he/she would be taken to another page that displays a greeting message.
alert("Username is required");
alert("Age can't be negative");
<!\u2014 validateForm method is called and specified as a value of
onsubmit value, if this method returns false, the user remains
on the same page
This action might not be possible to undo. Are you sure you want to continue?