1、作用
- 往前台传数据,可以传对象,可以传List,通过el表达式 ${}可以获取到,
@Controller
public class UserController {
@Autowired
UserMapper userMapper;
@RequestMapping("/user")
public String userMapper(Model m){
List<User> users = userMapper.findAll();
m.addAttribute("user", users);
return "user";
}
}