POJO is short for Plain Old Java Object. It is generally used to represent a bean following the typical JavaBean conventions. Typically, it contains private member variables with getters and setters and a no-argument constructor.
A form-backing Object is used to represent the values entered/shown by/to the user in a form. Model is used to populate data used to render a View—select boxes, option buttons, and so on.
We will create a simple POJO to act as a command object. Important parts of the class are listed as follows:
public class User {
private String guid;
private String name;
private String userId;
private String password;
private String password2;
//Constructor
//Getters and Setters
//toString
}
We are going to capture name, user ID, and password in the form. In the preceding class, we have fields corresponding to each of them, along with a password confirmation field, password2, and a unique identifier field, guid.
The Constructor, getters, setters, and toString methods are not shown for brevity. This class does not have any annotations or Spring-related mappings. Any bean can act as a form-backing object.