Java Reference
In-Depth Information
The page controller is responsible for invoking the business object, which returns
POJOs to be populated in views. Listing 3-47 shows the controller that binds the transfer
object in the request scope.
Listing 3-47. PolicyDetailsController.java
public class PolicyDetailsController implements Controller {
//set using setter injection
private PolicyBusinessDelegate businessDelegate;
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
//policy id is part of the request,
PolicyDetail policyDetail = getBusinessDelegate()
.getPolicyDetails(policyId);
return new ModelAndView("policydetails","policydetails",policyDetail);
}
}
Finally, Listing 3-48 shows the JavaBean or POJO view helper. This class contains a set
of fields and getters/setters for all these fields.
Listing 3-48. PolicyDetailsController.java
public class PolicyDetail implements Serializable {
private long policyId;
private String firstName;
private String lastName;
private int age;
public long getPolicyId() {
return policyId;
}
public void setPolicyId(long policyId) {
this.policyId = policyId;
}
public int getAge() {
return age;
 
Search WWH ::




Custom Search