Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
21541 ashik.ali 1
package com.spice.profitmandi.controller;
2
 
3
import java.util.HashSet;
4
import java.util.Set;
5
 
6
import org.springframework.stereotype.Controller;
7
import org.springframework.ui.ModelMap;
8
import org.springframework.web.bind.annotation.ModelAttribute;
9
import org.springframework.web.bind.annotation.RequestMapping;
10
import org.springframework.web.bind.annotation.RequestMethod;
11
 
12
import com.spice.profitmandi.model.Car;
13
 
14
@Controller
15
public class CarController {
16
 
17
	@RequestMapping(value = "/cars", method = RequestMethod.GET)
18
	public String init(@ModelAttribute("model") ModelMap model) {
19
		Set<Car> cars = new HashSet<>();
20
		cars.add(new Car("Honda", "Civic"));
21
		cars.add(new Car("Toyota", "Camry"));
22
		cars.add(new Car("Nisaan", "Altima"));
23
	    model.addAttribute("cars", cars);
24
	    return "cars";
25
	}
26
 
27
	@RequestMapping(value = "/index", method = RequestMethod.GET)
28
	public String indexPage(){
29
		return "index";
30
	}
31
}