利用jsp提交表单出现问题
利用jsp提交表单,不能访问到我的控制器
<form method="post" th:action="@{/Login_u}"> 用户Id:<input type="text" name="user_id"><br> 密码:<input type="text" name="user_pw"><br> <input type="submit" name="sub" value="登入"><br> </form>
@RequestMapping("/Login_u") public String login(@RequestParam(value = "user_id", required = false) Integer user_Id, @RequestParam(value = "user_pw", required = false) String pw) { System.out.println("test 尝试跳转"); if (user_Id != null) { Account account = new Account(); account = re.findById(user_Id).orElse(null); if(account==null) return "redirect:/wellcome"; if (account.getPassword().equals(pw)) { return "redirect:/Main"; } } return "redirect:/Login"; }