modelAndView 和RequestParam初识
来源:互联网 发布:巨大物体恐惧症 知乎 编辑:程序博客网 时间:2024/06/16 16:14
@Controller@RequestMapping("/student")public class StudentController { public static List<Student> studentList=new ArrayList<Student>(); static{ studentList.add(new Student(1, "cai", "123")); studentList.add(new Student(2, "cai1", "123")); studentList.add(new Student(3, "cai2", "123")); } @RequestMapping("/login") public ModelAndView login(@RequestParam(value="username" )String username, @RequestParam(value="password") String password){ ModelAndView mav=new ModelAndView(); for (int i = 0; i < studentList.size(); i++) { if(studentList.get(i).getUsername().equals(username)&&studentList.get(i).getPassword().equals(password)){ mav.setViewName("success"); System.out.println("zhaodao"); return mav; } } mav.setViewName("error"); mav.addObject("msg","error msg"); return mav; }
@RequestParam(value="username" ) 接收参数
ModelAndView 设置视图和参数等
阅读全文
0 0
- modelAndView 和RequestParam初识
- ModelMap和ModelAndView
- ModelMap和ModelAndView
- ModelMap和ModelAndView
- Spring -- Model 和 ModelAndView
- ModelMap和ModelAndView
- modelMap 和modelAndView
- @RequestParam和flashMessage
- @PathVariable和@RequestParam
- @RequestBody和@RequestParam区别
- @RequestParam和@PathVariable区别
- @RequestParam 和@RequestBody详解
- 浅析 @PathVariable 和 @RequestParam
- @RequestBody和@RequestParam区别
- requestparam和requestbody区别
- @RequestBody和@RequestParam区别
- @RequestMapping和@RequestParam
- @RequestBody和@RequestParam区别
- HTTP上传base64编码字符"+"变空格的问题
- c++ 读取文本文档中的数据到二维数组中
- 网络安全基础问答25例
- 2017天梯赛初赛总结(2017/3/31)
- solr全文检索服务器与tomact整合 IK Analyzer 2012FF_hf1 中文分词器的配置
- modelAndView 和RequestParam初识
- Hiding Gold LightOJ
- SQL server 怎样可以让一个数据库用几个磁盘分区
- HDU 1060
- error at ::0 can't find referenced pointcut解决办法
- 物联网
- 神经网络新手入门(1)
- Windows下字体渲染工具推荐
- vue第一步