MVC案例登录页面
MVC概念的基本应用,基于MySQL数据库。
1,新建login.jsp页面,也就是首页,代码如下:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>登录</title>
</head>
<body>
<form action="loginServlet" method="post">
<%--@declare id="uname"--%>
<%--@declare id="pwd"--%>
<label for="uname">用户名:</label>
<input type="text" name="username"><br>
<label for="pwd">密码</label>
<input type="password" name="pwd"><br>
<input type="submit" value="登录">
</form>
</body>
</html>
2,新建模型层,处理登录请求。代码如下: