@Controller public class LoginController{ private Model model; @RequestMapping("/login"); public String login(){ model.addAttribute("name","zhangshan"); ... } }
B.
@Controller public class LoginController{ @RequestMapping("/login"); public String login(){ Model model; model.addAttribute("name","zhangshan"); ... } }
C.
@Controller public class LoginController{ @RequestMapping("/login"); public String login(Model model){ model.addAttribute("name","zhangshan"); ... } }
D.
@Controller public class LoginController{ @RequestMapping("/login"); public String login(){ model.addAttribute("name","zhangshan"); ... } }