Rev 21749 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.controller;import java.util.HashSet;import java.util.Set;import org.springframework.stereotype.Controller;import org.springframework.ui.ModelMap;import org.springframework.web.bind.annotation.ModelAttribute;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import com.spice.profitmandi.model.Car;@Controllerpublic class CarController {@RequestMapping(value = "/cars", method = RequestMethod.GET)public String init(@ModelAttribute("model") ModelMap model) {Set<Car> cars = new HashSet<>();cars.add(new Car("Honda", "Civic"));cars.add(new Car("Toyota", "Camry"));cars.add(new Car("Nisaan", "Altima"));model.addAttribute("cars", cars);return "cars";}@RequestMapping(value = "/index", method = RequestMethod.GET)public String indexPage(){return "index";}}