首页 新闻 赞助 找找看

用户登录后,页面跳转失败。

0
悬赏园豆:10 [已解决问题] 解决于 2019-08-09 16:09

控制层代码:
@RequestMapping(value ="/denglu",method=RequestMethod.POST)
@ResponseBody
public String denglu(@RequestParam("phone")String phone,@RequestParam("password")String password){
System.out.println("进入账号密码验证");
System.out.println("手机号:"+phone);
Users mima=this.userService.denglu(phone);
if(mima!=null){
System.out.println(mima);
System.out.println("数据密码:"+mima.getPassword());
System.out.println("页面密码:"+password);
if(password.equals(mima.getPassword())){
/model.addAttribute("msg", "fqf");/
System.out.println("进入首页");
return "index";}
else{
/model.addAttribute("msg", "fqf");/
System.out.println("进入登录界面");
return "login";}
}
else{
/model.addAttribute("msg", "fqf");/
System.out.println("进入登录界面");
return "login";
}
}

页面代码:
<div style="padding-top: 200px" align="center">
<form action="denglu" method="post" >
账号: <input type="number" name="phone" placeholder="手机号/用户名" id="phone" >
<br> <br>
密码: <input type="password" name="password" placeholder="********" id="password">
<br> <br>
<input type="submit" value="登录" style="border: 0px blue none; width: 100px">
<br>
</form>
</div>

页面效果:还是处于登录弹窗 就是内容是返回值(index) 并没有返回系统首页

风御浪的主页 风御浪 | 初学一级 | 园豆:171
提问于:2019-08-08 16:16
< >
分享
最佳答案
1

@ResponseBody这个注解去掉

收获园豆:10
小光 | 小虾三级 |园豆:1766 | 2019-08-08 16:24

去掉后 报错: Error resolving template "/index", template might not exist or might not be accessible by any of the configured Template Resolvers

风御浪 | 园豆:171 (初学一级) | 2019-08-08 16:32

@风御浪: 找不到index页面,你看下index页面的目录修改一下

小光 | 园豆:1766 (小虾三级) | 2019-08-08 16:36

@小光:很尴尬

风御浪 | 园豆:171 (初学一级) | 2019-08-08 16:42
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册