package Com.Jsxs.Controller;
import Com.Jsxs.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
@RequestMapping("/user")
public class Controller6 {
/*
1.接受前端用户传递的参数,判断参数的名字,假设名字直接在方法上,可以直接使用
2.传递的是一个对象,匹配User对象中的字段名;如果说名字一致则赋值,否则就不能进行赋值
*/
@GetMapping("/t2")
public String test2(User user,Model model){
model.addAttribute("msg",user);
return "hello";
}
}