Creating a command or form backing object

POJO stands for Plain Old Java Object. It is usually 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.

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
}

A few important things to note are as follows:

  • This class does not have any annotations or Spring-related mappings. Any bean can act as a form-backing object.
  • We are going to capture the name, user ID, and password in the form. We have a password confirmation field, password2, and unique identifier field guid.
  • Constructor, getters, setters, and toString methods are not shown for brevity.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset