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 ...

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.