Java Reference
In-Depth Information
Listing 4-28.
public class SaveNewPolicyController extends SimpleFormController {
private UnderwritingBusinessService uwrBusinessService;
public void setUwrBusinessService(
UnderwritingBusinessService uwrBusinessService) {
this.uwrBusinessService = uwrBusinessService;
protected void doSubmitAction(Object formbean) throws Exception {
PolicyFormBean policyBean = (PolicyFormBean)formbean;
, policyBean.getFirstName(), policyBean.getAge());
protected Object formBackingObject(HttpServletRequest req) throws Exception {
PolicyFormBean policyBean = (PolicyFormBean)super.formBackingObject(req);
return policyBean;
protected ModelAndView onSubmit(Object formbean) throws Exception {
PolicyFormBean policyBean = (PolicyFormBean)formbean;
return new ModelAndView(this.getSuccessView(),"policydetails",formbean);
The page controller in Listing 4-28 in fact works with business interface proxies. To
inject the business interface proxy, I will use the SimpleRemoteStatelessSessionProxy å
FactoryBean class. This factory bean performs two tasks. It looks up the EJB home inter-
face and caches it. It also creates a proxy object implementing the business interface. The
proxy object is injected into the page controller. The first business method invocation on
the proxy will result in the creation of the remote object by invoking the create method
on the cached home interface. It will then delegate the business processing to the remote
object. This is possible because the remote object also implements the business inter-
face. Listing 4-29 shows the configuration of this service locator and the page controller.
Search WWH ::

Custom Search