<body class="text-center">
<form class="form-signin" action="dashboard.html" th:action="@{/user/register}" method="post">
<img class="mb-4" th:src="https://bbs.csdn.net/topics/@{/asserts/img/bootstrap-solid.svg}" alt="" width="72" height="72">
<h1 class="h3 mb-3 font-weight-normal" th:text="#{login.tip}">Please sign in</h1>
<!--判斷-->
<p style="color: red" th:text="${msg}" th:if="${not #strings.isEmpty(msg)}"></p>
<label class="sr-only" th:text="#{login.username}">Username</label>
<input type="text" name="name" class="form-control" placeholder="Username" th:placeholder="#{login.username}" required="" autofocus="">
<label class="sr-only" th:text="#{login.password}">Password</label>
<input type="password" name="pwd" class="form-control" placeholder="Password" th:placeholder="#{login.password}" required="">
<label class="sr-only" th:text="#{login.password}">Password</label>
<input type="password" name="pwd" class="form-control" placeholder="Password" th:placeholder="#{login.password}" required="">
<label class="sr-only" th:text="#{login.telephone}">telephone</label>
<input type="text" name="telephone" class="form-control" placeholder="telephone" th:placeholder="#{login.telephone}" required="">
<button class="btn btn-lg btn-primary btn-block" type="submit" th:text="#{login.register}">register in</button>
<button class="btn btn-lg btn-primary btn-block" type="button" th:text="#{login.btn}" onclick="window.location.href='https://bbs.csdn.net/topics/index.html'">Sign in</button>
<p class="mt-5 mb-3 text-muted"> 2020-2025</p>
<a class="btn btn-sm" th:href="https://bbs.csdn.net/topics/@{/index.html(l='zh_CN')}">中文</a>
<a class="btn btn-sm" th:href="https://bbs.csdn.net/topics/@{/index.html(l='en_US')}">English</a>
</form>
</body>
@PostMapping(value="https://bbs.csdn.net/user/register")
public String Register(@RequestParam("name")String name,
@RequestParam("pwd")String pwd,
@RequestParam("telephone")String telephone,
@RequestParam("date")String date){
User user = new User();
user.setDate(new Date());
user.setName(name);
user.setPwd(pwd);
user.setTelephone(telephone);
User user1 = userDao.save(user);
System.out.println("==========="+user);
return "redirect:/login";
}
控制臺顯示:
2020-02-19 20:03:17.181 WARN 7968 --- [nio-8083-exec-4] o.s.web.servlet.PageNotFound : Request method 'POST' not supported
2020-02-19 20:03:17.187 WARN 7968 --- [nio-8083-exec-4] o.s.web.servlet.PageNotFound : Request method 'POST' not supported
瀏覽器顯示:

新手小白請哪位大神 告訴我這是怎么回事?
我想請求后跳回登錄界面
uj5u.com熱心網友回復:
000000轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/149218.html
標籤:Java EE
下一篇:javaweb專案之間的跳轉問題
