springMVC怎样传值的?

1、通过前台表单传值指明到哪个层,利用@RequestParam这个注解

 1 //例如:
 2 @Controller 
 3 public class a{
 4 
 5 @RequestMapping("/login") 
 6  public String login(@RequestParam("username") String username,  
 7                         @RequestParam("password") String password,Model model){
 8     
 9      model.addAttribute("username", username);  
10     return "";
11 }

这种用来表单的提交

猜你喜欢

转载自www.cnblogs.com/dameimao/p/9008407.html