Java Reference
In-Depth Information
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
Thus, a form bean is a POJO with a get and set method for each field. Note that the
field name in this class exactly matches the name attribute of the HTML input elements.
Listing 3-22 shows the controller implementation.
Listing 3-22. SaveNewPolicyController.java
public class SaveNewPolicyController extends AbstractCommandController {
private UnderWritingBusinessDelegate uwrBusinessDelegate;
public SaveNewPolicyController() {
this.setCommandClass(PolicyFormBean.class);
}
public void setUwrBusinessDelegate(
UnderWritingBusinessDelegate uwrBusinessDelegate) {
this.uwrBusinessDelegate = uwrBusinessDelegate;
}
protected ModelAndView handle(HttpServletRequest request,
HttpServletResponse res, Object formBean, BindException errors)
throws Exception {
PolicyFormBean policyBean = (PolicyFormBean) formBean;
log.info("First Name--" + policyBean.getFirstName());
log.info("Last Name--" + policyBean.getLastName());
log.info("Age --" + policyBean.getAge());
this.uwrBusinessDelegate.createPolicy(policyBean);
return new ModelAndView("showPolicydetails","policydetails",policyBean);
}
}
 
Search WWH ::




Custom Search