idzik

Java-Spring1

Feb 1st, 2017
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. package p.idzik2.controller;
  2.  
  3. import org.springframework.stereotype.Controller;
  4. import org.springframework.ui.ModelMap;
  5. import org.springframework.web.bind.annotation.GetMapping;
  6. import org.springframework.web.bind.annotation.ResponseBody;
  7.  
  8. /**
  9.  * Created by operator on 31.01.2017.
  10.  */
  11.  
  12.  
  13. @Controller
  14. public class HelloController {
  15.     //@ResponseBody
  16.     @GetMapping("/")
  17.     public String hello(ModelMap modelMap){
  18.         modelMap.addAttribute("text","hello");
  19.         return "hello";
  20.     }
  21.  
  22.     @GetMapping("/if")
  23.     public String ifMethod(ModelMap modelMap){
  24.         modelMap.addAttribute("text","Sample text");
  25.         modelMap.addAttribute("a",123);
  26.         modelMap.addAttribute("b",10);
  27.         return "if";
  28.     }
  29.  
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment