第一步:前台页面
login.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<!-- 规范代码格式xmlns,以便下面使用th-->
<head>
<meta charset="UTF-8">
<title>登录</title>
</head>
<body>
<form id="newForm">
<div>
<input id="loginName" type="text" name="name" />
</div>
<div>
<input id="loginPassword" type="password" name="password"/>
</div>
<input>
<button type="submit" id="btn_login">登录</button>
<!-- id是这个button唯一标识-->
</form>
<!-- <th:block th:replace="common/include"></th:block>-->
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<th:block th:replace="js/login_js3"></th:block>
<!-- 引入外部文件-->
</body>
</html>
第二步:程序入口
loginController.class
package com.neimin.test.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class loginController {
@RequestMapping("/login")
public String login(){
return "login";
}
// @RequestMapping("/aaa")
//