老师我想跳转post下的路径如何跳转
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | @Controller ( "userController" ) @RequestMapping ( "/user" ) public class UserController { @Autowired private UserBiz userBiz; //tologin @RequestMapping ( "/tologin" ) public String toLogin(){ /* CommentBiz commentBiz=new CommentBizImpl(); int in=commentBiz.selectByPostId(1); System.out.println("jilu"+in);*/ return "page/login" ; } //login @RequestMapping ( "/login" ) public String login(HttpSession session, @RequestParam String username, @RequestParam String password){ if (username== null ){ return "redirect:tologin" ; } else { User user=userBiz.select(username); System.out.println( "user" +user); if (user.getPassword().equals(password)){ session.setAttribute( "user" ,user); return "redirect:post/toList" ; } else { System.out.println( "tologin" ); return "redirect:tologin" ; }} } |
12
收起
正在回答 回答被采纳积分+1
1回答
4. SSM到Spring Boot入门与综合实战
- 参与学习 人
- 提交作业 323 份
- 解答问题 8263 个
本阶段将带你学习主流框架SSM,以及SpringBoot ,打通成为Java工程师的最后一公里!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧