求解答求解答求解答求解答求解答

    //控制器
    private ModelAndView mv=new ModelAndView();
    @RequestMapping("/login")
    public ModelAndView login(String more,String password){
        try{
            System.out.println("=====进来登录了=====");
            User one = userService.getOne(more,password);
            mv.addObject("one",one);
            mv.setViewName("redirect:/question/showRecommend");
            return mv;
        }catch (Exception e){
            mv.addObject("e",e);
            mv.setViewName("jsp/login");
            return mv;
        }
    }

    //jsp
  <form  action="${pageContext.request.contextPath}/user/login" method="post">
      <div class="form-group">
        <input type="text" class="form-control" placeholder="用户名/手机号/箱"name="more">
        <input type="password" class="form-control" placeholder="密码" name="password" >
      </div>
       <button type="submit" class="btn btn-info block full-width m-b">登 录</button>       
       <a href="${pageContext.request.contextPath}/jsp/regist.jsp">注册一个新账号</a>
  </form>               
 
  
                 
                程序进入了控制器,接收到了前台的参数。可以跳转到jsp页面但是无法跳转到另外一个控制器里,页面一直显示等待响应

 

查看全部
weixin_49564258
weixin_49564258
2020/11/24 19:39
  • spring
  • java
  • tomcat
  • maven
  • java-ee
  • 点赞
  • 收藏
  • 回答
    私信

1个回复