Java Reference
In-Depth Information
To execute this modified workflow, I will need to map the request parameters to the
form bean in some component. You already know that the most appropriate component
for this is the handler adapter. Listing 3-40 shows the handler adapter that executes the
SimpleFormThrowaway controllers.
Listing 3-40.
public class SimpleFormThrowawayControllerHandlerAdapter
extends ThrowawayControllerHandlerAdapter {
public boolean supports(Object handler) {
return (handler instanceof SimpleFormThrowawayController);
public ModelAndView handle(HttpServletRequest req, HttpServletResponse res,
Object command) throws Exception {
SimpleFormThrowawayController throwaway = (SimpleFormThrowawayController)
Object formBean = throwaway.getFormbeanClass().newInstance();
ServletRequestDataBinder binder = createBinder(req, formBean);
return throwaway.execute(formBean);
protected ServletRequestDataBinder createBinder(
HttpServletRequest request, Object formbean) throws Exception {
ServletRequestDataBinder binder = new ServletRequestDataBinder(formbean,
initBinder(request, binder);
return binder;
Note that the createBinder method is responsible for binding the HTTP parameter
values to the properties of the form bean. The handler adapter takes care of all the
Search WWH ::

Custom Search