There are two main methods for validating forms: (usually done using Java Script).Server-side validation is more secure but often more tricky to code, whereas client-side (Java Script) validation is easier to do and quicker too (the browser doesn't have to connect to the server to validate the form, so the user finds out instantly if they've missed out that required field! In this tutorial we'll build a simple form with client-side Java Script validation.A lot of websites now require registration, meaning that users need to be assigned a username and password.
If the values do not match an error message is displayed using Java Script Alert Message Box and False value is returned in order to stop the form submission. Otherwise, get the corresponds message from the resource bundle (properties file). Validation Utils; import org.springframework.validation. Simple Form Controller; import com.mkyong.customer.model. Customer; public class Password Controller extends Simple Form Controller Create a password validator class to check on the both password fields : must not be blank, “password” and “confirm Password” must be match. If you’ve built a Java web application, you know the involved in building out proper authentication and user management.Even if you use a great framework like Apache Shiro or Spring Security, there’s still a lot of boring UI work and high risk backend work.