-
Notifications
You must be signed in to change notification settings - Fork 164
Expand file tree
/
Copy pathIndexController.java
More file actions
34 lines (26 loc) · 845 Bytes
/
IndexController.java
File metadata and controls
34 lines (26 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package guru.springframework.controllers;
import guru.springframework.services.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Created by jt on 1/20/16.
*/
@Controller
public class IndexController {
private ProductService productService;
@Autowired
public void setProductService(ProductService productService) {
this.productService = productService;
}
@RequestMapping({"/", "index"})
public String getIndex(Model model){
model.addAttribute("products", productService.listProducts());
return "index";
}
@RequestMapping("secured")
public String secured(){
return "secured";
}
}