jsp方面
getAll.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type="text/css" >
table {border-collapse =collapse;
border-spacing: 0;
border-left: 1px solid #888;
border-top: 1px solid #888;
background: #efeffe;
}
</style>
<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">
</head>
<body>
<h5 style="text-align: center;"> ${sessionScope.user.username}的通讯录: </h5>
<h5 style="text-align: center;">
<a href="<%=request.getContextPath()%>/user/toUpdateUser.action?user_id=${sessionScope.user.id}">修改用户信息</a>
<a href="<%=request.getContextPath()%>/contact/toSave.action?user_id=${sessionScope.user.id}">增加联系人</a>
</h5>
<form align="center" action="/newssm/contact/dynamicSelect.action" method="post" id="dyform">
<td><p>姓名:<input type="text" id="t_name" name="t_name" style="width: 150px" /></p></td>
<td><p>学校:<input type="text" id="t_school" name="t_school" style="width: 150px"/></p></td>
<td><p>性别:<input type="text" id="t_gender" name="t_gender" style="width: 150px"/></p></td>
<td><input type="submit" value="查询" id="select"/></td>
</tr>
</table>
</form>
<table align="center" border="1">
<tr>
<th>编号</th>
<th>年龄</th>
<th>姓名</th>
<th>电话</th>
<th>学校</th>
<th>地址</th>
<th>性别</th>
<th>用户ID</th>
<th>操作</th>
</tr>
<c:forEach items="${sessionScope.contacts}" var="contact">
<tr>
<td>${contact.t_id}</td>
<td>${contact.t_age}</td>
<td>${contact.t_name}</td>
<td>${contact.t_phone}</td>
<td>${contact.t_school}</td>
<td>${contact.t_address}</td>
<td>${contact.t_gender}</td>
<td>${contact.user_id}</td>
<td>
<a href="<%=request.getContextPath()%>/contact/toUpdate.action?t_id=${contact.t_id}">修改</a>
<a href="<%=request.getContextPath()%>/contact/deleteById.action?t_id=${contact.t_id}&id=${sessionScope.user.id}">删除</a>
</td>
</tr>
</c:forEach>
</table>
<font color="red">${requestScope.message}</font>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户登录</title>
</head>
<body>
<form action="/newssm/user/login" method="post" id="myform">
<table align="center">
<tr>
<td><p>用户账户:<input type="text" id="username" name="username" style="width: 150px" /></p></td>
</tr>
<tr>
<td><p>用户密码:<input type="password" id="password" name="password" style="width: 150px"/></p></td>
</tr>
<tr>
<td><input type="submit" value="登录" id="login"/></td>
<!-- <td><input type="button" οnclick="javascript:window.location.href='insert.jsp';" value="注册" /></td> -->
</tr>
</table>
<%-- <font color="red">${requestScope.message}</font> --%>
<font color="red"><h5 style="text-align: center;"> ${requestScope.message} </h5></font>
</form>
</body>
</html>
insert.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="/newssm/user/insert" method="post" id="myform">
<table align="center">
<tr>
<td><p>用户账户:<input type="text" id="username" name="username" style="width: 150px" /></p></td>
</tr>
<tr>
<td><p>用户密码:<input type="password" id="password" name="password" style="width: 150px"/></p></td>
</tr>
<tr>
<td><input type="submit" value="注册" id="login"/></td>
</tr>
</table>
<font color="red">${sessionScope.message}</font>
</form>
</body>
</html>
user_update.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改用户</title>
</head>
<body>
<form action="/newssm/user/updateUser.action" method="post" id="updateForm">
<table align="center">
<input type="hidden" name="id" value="${user.id}">
<tr>
<td><p>用户名:<input type="text" name="username" value="${user.username}" readonly></p></td>
</tr>
<tr>
<td><p>密 码:<input type="text" name="password" value="${user.username}"></p></td>
</tr>
<tr>
<td><p><input type="submit" value="修改"></p></td>
</tr>
</table>
</form>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>增加</title>
</head>
<body>
<form action="/newssm/contact/save" method="post" id="saveform">
<table align="center">
<tr>
<td><p>年龄:<input type="text" id="t_age" name="t_age" style="width: 150px" /></p></td>
</tr>
<tr>
<td><p>姓名:<input type="text" id="t_name" name="t_name" style="width: 150px"/></p></td>
</tr>
<tr>
<td><p>电话:<input type="text" id="t_phone" name="t_phone" style="width: 150px" /></p></td>
</tr>
<tr>
<td><p>学校:<input type="text" id="t_school" name="t_school" style="width: 150px"/></p></td>
</tr>
<tr>
<td><p>地址:<input type="text" id="t_address" name="t_address" style="width: 150px" /></p></td>
</tr>
<tr>
<td><p>性别:<input type="text" id="t_gender" name="t_gender" style="width: 150px"/></p></td>
</tr>
<tr>
<td><p>用户ID:<input type="text" name="user_id" value="${sessionScope.user_id}" readonly style="width: 150px"/></p></td>
</tr>
<tr>
<td><input type="submit" value="确认舔加" id="login"/></td>
</tr>
</table>
</form>
</body>
</html>
contact_update.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改</title>
</head>
<body>
<form action="/newssm/contact/doUpdate.action" method="post" id="updateForm">
<table align="center">
<input type="hidden" name="t_id" value="${contact.t_id}">
<tr>
<td><p>年龄:<input type="text" name="t_age" value="${contact.t_age}"></p></td>
</tr>
<tr>
<td><p>姓名:<input type="text" name="t_name" value="${contact.t_name}"></p></td>
</tr>
<tr>
<td><p>电话:<input type="text" name="t_phone" value="${contact.t_phone}"></p></td>
</tr>
<tr>
<td><p>学校:<input type="text" name="t_school" value="${contact.t_school}"></p></td>
</tr>
<tr>
<td><p>地址:<input type="text" name="t_address" value="${contact.t_address}"></p></td>
</tr>
<tr>
<td><p>性别:<input type="text" name="t_gender" value="${contact.t_gender}"></p></td>
</tr>
<input type="hidden" name="user_id" value="${contact.user_id}">
<tr>
<td><p><input type="submit" value="修改"></p></td>
</tr>
</table>
</form>
</body>
</html>
dy_contact.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type="text/css" >
table {border-collapse =collapse;
border-spacing: 0;
border-left: 1px solid #888;
border-top: 1px solid #888;
background: #efeffe;
}
</style>
</head>
<body>
<h3 style="text-align: center;">查询结果:</a></h3>
<br>
<table align="center" border="1">
<tr>
<th>编号</th>
<th>年龄</th>
<th>姓名</th>
<th>电话</th>
<th>学校</th>
<th>地址</th>
<th>性别</th>
<th>用户ID</th>
</tr>
<c:forEach items="${sessionScope.dyContact}" var="contact">
<tr>
<td>${contact.t_id}</td>
<td>${contact.t_age}</td>
<td>${contact.t_name}</td>
<td>${contact.t_phone}</td>
<td>${contact.t_school}</td>
<td>${contact.t_address}</td>
<td>${contact.t_gender}</td>
<td>${contact.user_id}</td>
</tr>
</c:forEach>
</table>
</body>
</html>