package zti.web; import java.util.HashMap; import java.util.Map; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; @Controller(value = "saySimpleController") @RequestMapping("/labs") public class SimpleController { @RequestMapping("/lab01") public ModelAndView lab01() { Map modelData = new HashMap(); modelData.put("msg", "Hello, world!"); return new ModelAndView("script01.jsp", modelData); } @RequestMapping("/lab02") public String lab02(@RequestParam(name="name", defaultValue="Anonim") String name, Model model) { //Map modelData = new HashMap(); //modelData.put("msg", "Hello, world!"); model.addAttribute("mess","Hello " + name + "!"); //return new ModelAndView("script02.jsp", modelData); return "script02.jsp" ; } }