Java Reference
In-Depth Information
Listing 3-34 shows the ThrowawayController implementation. For each property it
defines a getter/setter combination to map the form fields. The handler adapter extracts
the form field values using the servlet API and maps them to the properties of this con-
troller. This makes the controller reusable and free from protocol specifics. It can very
well be used with Swing components with an appropriate handler adapter.
Listing 3-34. SaveClaimController.java
public class SaveClaimController implements ThrowawayController {
private String claimantName;
private String policyNo;
private String productCd;
public ModelAndView execute() throws Exception {
//Invoke business logic here
return new ModelAndView("claimDetails");
}
public String getClaimantName() {
return claimantName;
}
public void setClaimantName(String claimantName) {
this.claimantName = claimantName;
}
public String getPolicyNo() {
return policyNo;
}
public void setPolicyNo(String policyNo) {
this.policyNo = policyNo;
}
public String getProductCd() {
return productCd;
}
public void setProductCd(String productCd) {
this.productCd = productCd;
}
}
Listing 3-35 shows the JSP that maps to the throwaway controller shown just now.
Search WWH ::




Custom Search