Click here to Skip to main content
15,113,991 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<%@ taglib prefix="form" uri="" %>  
<!DOCTYPE html>

<title>Customer Registration Form</title>

	.error {
	Fill out the form.Asterisk(*) means required.
	<form:form action="processForm" modelAttribute="customer">
		First name: <form:input path="firstName"/>
		Last name(*):  <form:input path="lastName"/>
		<form:errors path="lastName" cssClass="error"/>
		Free passes: <form:input path="freePasses" />
		<form:errors path="freePasses" cssClass="error" />
		<input type="submit" value="Submit" />

public class Customer {
	private String firstName;
	@NotNull(message="is required")
	@Size(min=1, message="is required")
	private String lastName;
	@Min(value=0,message="must be greater than or equal to zero")
	@Max(value=10,message="must be less than or equal to ten")
	private int freePasses;
	public String getFirstName() {
		return firstName;

	public void setFirstName(String firstName) {
		this.firstName = firstName;

	public String getLastName() {
		return lastName;

	public void setLastName(String lastName) {
		this.lastName = lastName;

	public int getFreePasses() {
		return freePasses;

	public void setFreePasses(int freePasses) {
		this.freePasses = freePasses;


What I have tried:

I have used this code only I have tried many ways but can't see the error messages what to do? I also imported the required libraries and called that and also passed getter and setter too but still cant see errors 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900