KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > demo > icare > web > CarSearchFormController


1 package org.objectweb.petals.demo.icare.web;
2
3 import java.util.Map JavaDoc;
4
5 import javax.servlet.http.HttpServletRequest JavaDoc;
6
7 import org.objectweb.petals.demo.icare.model.dto.CarSearchDto;
8 import org.objectweb.petals.demo.icare.service.CarService;
9 import org.springframework.ui.ModelMap;
10 import org.springframework.validation.Errors;
11 import org.springframework.web.servlet.mvc.SimpleFormController;
12
13 /**
14  * The controller for the car search form
15  *
16  * @author Cristian Spiescu
17  * @since 15.01.2007
18  */

19 public class CarSearchFormController extends SimpleFormController {
20     
21     private CarService carService;
22     
23     public CarService getCarService() {
24         return carService;
25     }
26
27     public void setCarService(CarService carService) {
28         this.carService = carService;
29     }
30
31     protected Map JavaDoc referenceData(HttpServletRequest JavaDoc request, Object JavaDoc command, Errors errors) throws Exception JavaDoc {
32         return new ModelMap("categories", carService.getAllCategories());
33     }
34     
35     protected Object JavaDoc formBackingObject(HttpServletRequest JavaDoc request) throws Exception JavaDoc {
36         return new CarSearchDto();
37     }
38
39     protected void doSubmitAction(Object JavaDoc managedResource) throws Exception JavaDoc {
40         CarSearchDto dto = (CarSearchDto) managedResource;
41         carService.getAvailableCars(dto);
42     }
43
44 }
45
Popular Tags