综合开发
用java实现的登录页面,实现了客户端(浏览器)到服务器(Tomcat)再到后端(servlet程序)数据的交互。
登录html代码:
<!DOCTYPE>
<html>
<head>
<title>登录</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<link type="text/css" th:href="@{bootstrap/css/bootstrap.min.css}" rel="stylesheet">
<link rel="stylesheet" type="text/css" th:href="@{css/user/login.css}" >
<script type="text/javascript">
//跳出框架显示该页面
if (window != top)
top.location.href = location.href;
</script>
</head>
<body>
<div class="container">
<form class="form-signin" target="_top" action="/user/login" method="post" id="loginForm">
<input type="hidden" name="method" value="login" />
<h2 class="form-signin-heading">请登录</h2>
<table>
<tr>
<td width="70"></td>
<td><label class="error" id="msg" th:text="${msg}"></label></td>
</tr>
<tr>
<td width="70"><h4>用户名</h4></td>
<td><label class="sr-only" for="inputUserName">用户名</label> <input
name="uname" class="form-control" type="text"
required="" value="" /></td>
</tr>
<tr>
<td height="20"> </td>
<td><label id="loginnameError" class="error"></label></td>
</tr>
<tr>
<td><h4>密 码</h4></td>
<td><label class="sr-only" for="inputPassword"> 密码 </label> <input
class="form-control" type="password" name="password" required=""
value="" /></td>
</tr>
<tr>
<td height="20"> </td>
<td><label id="loginpassError" class="error"></label></td>
</tr>
<tr>
<td> </td>
<td align="left">
<button class="btn btn-lg btn-primary btn-block" type="submit">
登录</button>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
登录显示:
进入主页面: