1.前端页面:
main.jsp:
<body>
<h1>首页</h1>
${msg}
<p>
<a href="${pageContext.request.contextPath}/user/exit">注销</a>
</p>
</body>
index.jsp:
<body>
<a href="${pageContext.request.contextPath}/user/toLogin">登陆页面</a>
<a href="${pageContext.request.contextPath}/user/main">主页</a>
</body>
login.jsp:
<body>
<form action="${pageContext.request.contextPath}/user/login" method="post">
用户名:<input type="text" name="username">
密 码: <input type="text" name="password">
<input type="submit" value="提交">
</form>
</body>
2.编写controller