Skip to main content

Command Objects

Learn Command Objects (Form Handling, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes Command object (form-backing object) is a plain Java class whose fields mirror the form fields; Spring fills it from the request and the view reads it back. Round trip : the GET handler puts an empty (or pre-filled) command object in the model, the form binds to it, and the POST handler receives it filled. Plain bean : it needs a default constructor and getters and setters, or a record or a constructor Spring can bind to.

More lessons in Form Handling