信管117127伍昭颖-jsp课设-智多星手机管理系统

一、前端的功能

      “智多星”智能手机销售网,是面向用户端的网站,有注册账号、查询手机信息、查询订单等基本功能,能基本满足购买者的操作需求。之前下载的是SQLServer,没有下载MYSQL,SQLServer字符编码没有utf-8,导致连接数据库查询时出现乱码,经过多番请教与百度,下载了2017MYSQL和mysql-connector-java-8.0.16.jar数据库驱动,之后得知该版本的MYSQL和数据库驱动必须使用Class.forName("com.mysql.cj.jdbc.Driver");,而不能使用Class.forName("com.mysql.jdbc.Driver");,否则会出现”Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.“。改了就连接成功了。

链接数据库语句中还需要加上&serverTimezone=GMT%2B8,否则会出现区时性的错误。

最后,把连接数据库语句中的用户名和密码等参数修改好,就能成功连接了。

 

智多星主页

智多星登陆页面

    智多星注册页面

智多星浏览手机分类信息页面

 智多星查询手机信息页面

 智多新查看购物车页面

 二、后台功能

1.后台登陆界面

 

2.登陆成功进入手机信息管理页面,能查看树形菜单

3.删除手机简介信息

4.成功删除信息

5.点击手机信息管理页面的手机信息简介功能,进入手机信息简介页面

6.手机信息管理有搜索功能,输入“C555”进行搜索

7.点击进入手机信息管理页面的添加手机信息页面

8.从树形菜单进入手机订单管理页面,显示订单内容

9.点击订单信息管理的添加订单信息

10.从树形菜单进入管理员账号密码重置,重置管理员用户名:joey

11.相关数据库表截图

12.工程项目截图

 三、后台具体代码

1.Login.html代码如下。这是手机后台管理登陆界面,登陆成功后跳转到手机信息管理页面

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>请登陆</title>
		<link href="Resources/css/Login.css" type="text/css" rel="stylesheet" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
  		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css"> 
  		<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  		<script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
  		<script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script> 链接样式表  
		<script language="JavaScript">
			function checkForm(form){
				for(var i = 0;i<form.elements.length;i++){
					if((form.elements[i].type == "text"||form.elements[i].type == "password" )&& form.elements[i].value == ""){
						alert("请输入用户名或密码!");//用户名或者密码输入为空时,弹出提示语请输入用户名或密码
						return false;
					}
				}
				return true;
			}
			function exit(){   //点击退出按钮后询问是否真的要退出整个程序
			var res = confirm("是否要退出程序?");
                  if(res == true){
 					window.close();
 }
 					else {
 					window.location.href="Login.html";
 					}
}
	</script>
	<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
	<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-18" data-genuitec-path="/MobilePhoneSystem/WebContent/Login.html">
		<div id="bg" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-18" data-genuitec-path="/MobilePhoneSystem/WebContent/Login.html">
1			<div id="whiteblock">	
				<h2>手机后台管理系统</h2>
				<form action="ToCheckLogin.jsp" method="post" onsubmit="return checkForm(this)">
					<div class="input-group input-group-lg">
						<p><input type="text" name="logname" class="form-control user" placeholder="请输入管理员用户名" size="25"></p>
						<p><input type="password" name="password" class="form-control user" placeholder="请输入管理员密码" size="25"></p>
					</div>
					<p>
						<input type="submit" id="put" value="登录"  /> 
						<input type="reset" id="put" value="重置"  />
						<input type="button" id="put" value="退出" onclick="exit()"/>  
						<!--使用Bootstrap按钮来设置样式-->
					</p>
				</form>
			</div>
		</div>
	</body>
</html>

2.ToCheckLogin.jsp代码如下。连接数据库,查看是否有对应的登陆信息。

<%@page import="java.sql.SQLException"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
<title>Insert title here</title>
<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-7" data-genuitec-path="/MobilePhoneSystem/WebContent/ToCheckLogin.jsp">
<%
	//检验管理员的用户名密码是否正确
	request.setCharacterEncoding("UTF-8");
	String logname = request.getParameter("logname");
	String password = request.getParameter("password");
	String sqlQuery = "SELECT * FROM mobileshop.user WHERE logname='"+logname+"'AND password='"+password+"'";
	try{
		Class.forName("com.mysql.cj.jdbc.Driver");
		String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
		System.out.println("连接成功...");
		Connection con = DriverManager.getConnection(URL);
		Statement sql = con.createStatement();
		ResultSet rs = sql.executeQuery(sqlQuery);
		if(rs.next()){
			session.setAttribute("logname", logname);
			session.setAttribute("realname", rs.getString(3));
			response.sendRedirect("Menu.jsp");//登陆成功,重定向至菜单管理页面
		}else{
			out.print("<script language='JavaScript'>alert('您的用户名或密码有误,请重新输入或者注册');window.location.href='Login.html'</script>");
			//登陆失败,跳转到登陆页面
		}
		con.close();
	}catch(SQLException e){
		e.printStackTrace();
	}
%>
</body>
</html>

 

3.Menu.jsp代码如下。

登陆成功后跳转至主页面。主页面能实现手机信息和订单的查询、删除、添加功能。

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-23" data-genuitec-path="/MobilePhoneSystem/WebContent/Menu.jsp">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<%
if((String)session.getAttribute("logname")==null){
	out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
}
%>
<frameset rows="20%,*" frameborder="0" framespacing="10">
		<frame src="TopMenu.jsp" noresize="noresize" scrolling="yes" />
		<frameset cols="15%,*">
			<frame src="LeftMenu.html" noresize="noresize" />
			<frame src="MobileMenu.jsp?pages=1" name="contain" />
		</frameset>
	</frameset>
</html>

4.MobileMenu.jsp

进入主页面后,右方显示手机信息管理页面,此页面能查询、添加、删除、更新手机信息以及查看信息简介。

<%@page import="java.sql.SQLException"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<!-- Bootstrap CSS -->
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
		<!-- Optional JavaScript -->
		<!-- jQuery first, then Popper.js, then Bootstrap JS -->
		<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
		<script type="text/javascript">
			function del() {
				if(!confirm("确认要删除?")) {
					window.event.returnValue = false;
				}
			}
		</script>
		<title>手机网后台管理系统</title>
		<style type="text/css">
			body {
				background-color: pink;
				font-family: "黑体";
			}
			
			form h1 {
				display: inline-block;
				width: 820px;
			}
			
			.check {
				padding: 30px 30px;
			}
			
			form {
				display: inline;
			}
			
			.contain {
				width: 1000px;
				border-radius: 10px;
				border: 1px #bbb solid;
				background-color: pink;
				padding-top: 20px;
			}
			
			button {
				margin-left: 10px;
			}
			
			.search {
				display: inline-block;
				margin-left: 500px;
			}
			
			.add {
				float: right;
				margin-right: 50px;
			}
			.pageNav{
				margin-left: 200px;
			}
		</style>
	<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>

	<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-5" data-genuitec-path="/MobilePhoneSystem/WebContent/MobileMenu.jsp">
		<%
		request.setCharacterEncoding("UTF-8");
		String pages = request.getParameter("pages");//获取当前页数
		int pagesNo = Integer.parseInt(pages);//把当前页数从字符串转为整型
		int startLine = (Integer.parseInt(pages)-1)*10;//指定数据库从哪一行开始读取
		%>
		<div class="contain pull-left" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-5" data-genuitec-path="/MobilePhoneSystem/WebContent/MobileMenu.jsp">
			<form action="ToSearchMobile.jsp" class="form-inline ">
				<h2>手机信息管理</h2>
				<div class="form-group search">
					<input type="text" name="check" class="form-control" placeholder="请输入查询手机名称或手机标识号" />
					<input type="submit" name="submit" value="搜索" />

				</div>
			</form>
			<a href="LookMobilePhone.jsp" target="_self"><button >手机信息简介</button></a>
			<a href="AddMobile.jsp" target="_self"><button>添加手机信息</button></a>
			<div class="pull-left">
				<table class="table table-hover">
					<thead>
						<tr>
							<th>手机标识号</th>
							<th>手机名称</th>
							<th>手机厂商</th>
							<th>手机价格</th>
							<th>手机简介</th>
							<th>手机模型图</th>
							<th>手机类别号</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
<%
	int pageSize = 10;//指定数据库一次读取多少行
	String sqlQuery = "SELECT * FROM mobileshop.mobileForm limit "+startLine+","+pageSize;//对数据库进行伪分页读取,一次只能读10行
	String sqlAll = "SELECT * FROM mobileshop.mobileForm";
	int pagesCount = 0;//用于数据库最后读出所有行后总共有多少页
	int lastRow = 0;//记录数据库的最后一行
	try{
		Class.forName("com.mysql.cj.jdbc.Driver");
		String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
		Connection con = DriverManager.getConnection(URL);
		Statement sql = con.createStatement();
		Statement stat = con.createStatement();
		ResultSet rs = sql.executeQuery(sqlQuery);
		ResultSet rsAll = stat.executeQuery(sqlAll);
		rsAll.last();
		lastRow = rsAll.getRow();//记录数据库最后一行
		while(rs.next()){
			out.print("<tr>");
			out.print("<td>"+rs.getString(1)+"</td>");
			out.print("<td>"+rs.getString(2)+"</td>");
			out.print("<td>"+rs.getString(3)+"</td>");
			out.print("<td>"+rs.getString(4)+"</td>");
			out.print("<td>"+rs.getString(5)+"</td>");
			out.print("<td>"+rs.getString(6)+"</td>");
			out.print("<td>"+rs.getString(7)+"</td>");
			out.print("<td><a href='AlertMobile.jsp?mobile_version="+rs.getString(1)+"'><button>更新</button></a><a href='DeleteMobile.jsp?mobile_version="+rs.getString(1)+"' onclick='javascript:return del();'><button>删除</button></a></td>");
			out.print("</tr>");
		}
		con.close();
	}catch(SQLException e){
		e.printStackTrace();
	}
%>

					</tbody>
				</table>
				<div class="pageNav">
					<ul class="pagination">
					<%
						int prePage;//上一页的页数
						if(pagesNo == 1){
							prePage = 1;//若当前页是第一页,则第一页只能是当前页
						}else{
							prePage = pagesNo - 1;//除了上述情况外上一页等于当前页-1页
						}
					%>
					<li class="page-item"><a class="page-link" href="MobileMenu.jsp?pages=<%=prePage%>">上一页</a></li>
					<%
						pagesCount = (lastRow % pageSize == 0) ? (lastRow / pageSize) : (lastRow / pageSize +1);//计算数据库能读出来的全部页数
						int minpages = (pagesNo - 3 >0) ? (pagesNo - 3) : 1;//设定最小页,防止页数小于第一页
						int maxpages = (pagesNo + 3 >= pagesCount) ? (pagesCount) : (pagesNo+3);//设定最大页
						for(int i = minpages;i <=maxpages ;i++){
							if(i == pagesNo){//当前页和遍历出来的页数相等时,需要通过调用css里面的样式“active"进行高亮
								out.print("<li class='page-item active'>");
								out.print("<a class='page-link' href='MobileMenu.jsp?pages="+i+"'>"+i+"</a>");
								out.print("</li>");
							}else{//输出每一个分页
								out.print("<li class='page-item'>");
								out.print("<a class='page-link' href='MobileMenu.jsp?pages="+i+"'>"+i+"</a>");
								out.print("</li>");
							}
							
						}
							//out.print("<li class='page-item'>");
							//out.print("<a class='page-link' href='#>...</a>");
							//out.print("</li>");
						
					%>
					<%
						int nextPage;
						if(pagesNo == pagesCount){//下一页的原理和上一页同理
							nextPage = pagesCount;
						}else{
							nextPage = pagesNo + 1;
						}
					%>
					<li class="page-item"><a class="page-link" href="MobileMenu.jsp?pages=<%=nextPage%>">下一页</a></li>
					</ul>
				</div>

			</div>

		</div>
	</body>

</html>

 

5.ToSearchMobile.jsp代码如下。查询手机信息

<%@page import="java.sql.SQLException"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<!-- Bootstrap CSS -->
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
		<!-- Optional JavaScript -->
		<!-- jQuery first, then Popper.js, then Bootstrap JS -->
		<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
		<script type="text/javascript">
			function del() {
				if(!confirm("确认要删除?")) {
					window.event.returnValue = false;
				}
			}
		</script>
		<title>手机信息管理系统</title>
		<style type="text/css">
			body {
				background-color: pink;
				font-family: "黑体";
			}
			
			form h1 {
				display: inline-block;
				width: 820px;
			}
			
			.check {
				padding: 30px 30px;
			}
			
			form {
				display: inline;
			}
			
			.contain {
				width: 1000px;
				border-radius: 10px;
				border: 1px #bbb solid;
				background-color: pink;
				padding-top: 20px;
			}
			
			button {
				margin-left: 10px;
			}
			
			.search {
				display: inline-block;
				margin-left: 500px;
			}
			}
		</style>
	<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>

	<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-15" data-genuitec-path="/MobilePhoneSystem/WebContent/DaoSearch.jsp">
		<div class="contain pull-left" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-15" data-genuitec-path="/MobilePhoneSystem/WebContent/ToSearchMobile.jsp">
			<form action="ToSearchOrder.jsp" class="form-inline ">
				<h2>查询结果</h2>
				<div class="form-group search">
					<input type="text" name="check" class="form-control" placeholder="请输入查询手机名称或手机标识号" />
					<input type="submit" name="submit" value="搜索" />

				</div>
			</form>
			<a href="AddMobile.jsp" target="_self"><button>添加手机信息</button></a>
			<div class="pull-left">
				<table class="table">
					<thead>
						<tr>
							<th>手机标识号</th>
							<th>手机名称</th>
							<th>手机厂商</th>
							<th>手机价格</th>
							<th>手机简介</th>
							<th>手机模型图</th>
							<th>手机类别号</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
	<%
	//查询功能
	if((String)session.getAttribute("logname")==null){
		out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
	}
	
	request.setCharacterEncoding("UTF-8");
	String search = request.getParameter("check");
	String sqlQuery;
	if(search.matches("[0-9]+")){
		sqlQuery = "SELECT * FROM mobileshop.mobileForm where mobile_version='"+search+"'";
	}else{
		sqlQuery = "SELECT * FROM mobileshop.mobileForm where mobile_name='"+search+"'";
	}
	
	try{
		Class.forName("com.mysql.cj.jdbc.Driver");
		String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
		Connection con = DriverManager.getConnection(URL);
		Statement sql = con.createStatement();
		ResultSet rs = sql.executeQuery(sqlQuery);
		while(rs.next()){
			out.print("<tr>");
			out.print("<td>"+rs.getString(1)+"</td>");
			out.print("<td>"+rs.getString(2)+"</td>");
			out.print("<td>"+rs.getString(3)+"</td>");
			out.print("<td>"+rs.getString(4)+"</td>");
			out.print("<td>"+rs.getString(5)+"</td>");
			out.print("<td>"+rs.getString(6)+"</td>");
			out.print("<td>"+rs.getString(7)+"</td>");
			out.print("<td><a href='AlertOrder.jsp?id="+rs.getString(1)+"'><button>更新</button></a><a href='DeleteOrder.jsp?id="+rs.getString(1)+"' onclick='javascript:return del();'><button>删除</button></a></td>");
			out.print("</tr>");
		}
		con.close();
	}catch(SQLException e){
		e.printStackTrace();
	}
%>

					</tbody>
				</table>
			</div>

		</div>
	</body>

</html>

 

6.LookMobilePhone.jsp代码如下。查看手机信息简介。

<%@page import="java.sql.SQLException"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<!-- Bootstrap CSS -->
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
		<!-- Optional JavaScript -->
		<!-- jQuery first, then Popper.js, then Bootstrap JS -->
		<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
		<script type="text/javascript">
			function del() {
				if(!confirm("确认要删除?")) {
					window.event.returnValue = false;
				}
			}
		</script>
		<title>手机信息管理系统</title>
		<style type="text/css">
			body {
				background-color:pink;
				font-family: "黑体";
			}
			
			form h1 {
				display: inline-block;
				width: 820px;
				font-family: "黑体";
			}
			
			.check {
				padding: 30px 30px;
			}
			
			form {
				display: inline;
			}
			
			.contain {
				width: 1000px;
				border-radius: 10px;
				border: 1px #bbb solid;
				background-color: pink;
				padding-top: 20px;
			}
			
			button {
				margin-left: 10px;
			}
			
			.search {
				display: inline-block;
				margin-left: 500px;
			}
			
			
		</style>
	<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>

	<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-19" data-genuitec-path="/MobilePhoneSystem/WebContent/LookMobilePhone.jsp">
		<div class="contain pull-left" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-19" data-genuitec-path="/MobilePhoneSystem/WebContent/LookMobilePhone.jsp">
			<form action="LookMobilePhone.jsp" class="form-inline ">
				<h2>手机简介</h2>
			</form>
			<div class="pull-left">
				<table class="table">
					<thead>
						<tr>
							<th>手机标识号</th>
							<th>手机名称</th>
						</tr>
					</thead>
					<tbody>
	<%
	//查询功能
	if((String)session.getAttribute("logname")==null){
		out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
	}
	
	request.setCharacterEncoding("UTF-8");
	String search = request.getParameter("check");
	String sqlQuery = "SELECT * FROM mobileshop.mobileClassify";
	try{
		Class.forName("com.mysql.cj.jdbc.Driver");
		String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
		Connection con = DriverManager.getConnection(URL);
		Statement sql = con.createStatement();
		ResultSet rs = sql.executeQuery(sqlQuery);
		while(rs.next()){
			out.print("<tr>");
			out.print("<td>"+rs.getString(1)+"</td>");
			out.print("<td>"+rs.getString(2)+"</td>");
			out.print("<td><a href='AlertMobile.jsp?id="+rs.getString(1)+"'><button>更新</button></a><a href='DeleteMobile.jsp?id="+rs.getString(1)+"' onclick='javascript:return del();'><button>删除</button></a></td>");
			out.print("</tr>");
		}
		con.close();
	}catch(SQLException e){
		e.printStackTrace();
	}
%>

					</tbody>
				</table>
			</div>

		</div>
	</body>

</html>

 

7.AddMobile.jsp代码如下。添加手机信息。

<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<!-- Bootstrap CSS -->
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
		<!-- Optional JavaScript -->
		<!-- jQuery first, then Popper.js, then Bootstrap JS -->
		<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
		<title>Insert title here</title>
		<style type="text/css">
			.form-control {
				width: 300px;
				height: 30px;
				float: right;
			}
			
			select {
				width: 210px;
				height: 30px;
			}
			
			.submit {
				margin-left: 100px;
				margin-right: 30px;
			}
			
			.contain {
				width: 1000px;
				border: 1px #bbb solid;
				background-color: pink;
				padding-top: 20px;
				border-radius: 10px;
			}
			
			label {
				display: inline-block;
				width: 100px;
				margin-right: 10px;
			}
			
			form {
				margin-left: 300px;
			}
		</style>
	<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>

	<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-0" data-genuitec-path="/MobilePhoneSystem/WebContent/AddMobile.jsp">
	<%
		if((String)session.getAttribute("logname")==null){
			out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
		}//提示登陆,并且在当前页面打开Login.html页面
	%>
		<div class="contain" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-0" data-genuitec-path="/MobilePhoneSystem/WebContent/AddMobile.jsp">
			<form action="ToAddMobile.jsp" method="post">
				<div class="form-group form-inline">
					<label for="mobile_version">标识号:</label>
				<input type="text" class="form-control" id="mobile_version" name="mobile_version" maxlength="15" required="required" placeholder="请输入你的手机标识号:">
				</div>
			<div class="form-group form-inline">
				<label for="mobile_name">手机名称:</label>
					<input type="text" class="form-control" id="mobile_name" name="mobile_name" required="required">
				</div>
				<div class="form-group form-inline">
					<label for="mMobile_made">手机厂商:</label>
					<input type="text" class="form-control" id="mMobile_made" name="mMobile_made" required="required">
				</div>
				<div class="form-group form-inline">
					<label for="mobile_price">手机价格:</label>
					<input type="text" class="form-control" id="mobile_price" name="mobile_price" required="required">
				</div>
				<div class="form-group form-inline">
					<label for="mobile_mess">手机简介:</label>
					<input type="text" class="form-control" id="mobile_mess" name="mobile_mess" required="required">
				</div>
				<div class="form-group form-inline">
					<label for="mobile_pic">手机模型图:</label>
					<input type="text" class="form-control" id="mobile_pic" name="mobile_pic" required="required">
				</div>
				<div class="form-group form-inline">
					<label for="id">手机类别号:</label>
					<input type="text" class="form-control" id="id" name="id" required="required">
				</div>
				<div class="form-group form-inline">
					<input type="submit" id="" name=""  value="添加"><input type="reset" value="重置" />
				</div>
			</form>
		</div>
	</body>
</html>

 

ToAddMobile.jsp代码如下。连接数据库添加手机信息。

<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.Statement"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
<title>Insert title here</title>
<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-8" data-genuitec-path="/MobilePhoneSystem/WebContent/DaoAddStudent.jsp">
<%

	//添加学生资料
	if((String)session.getAttribute("logname")==null){
		out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
	}

	request.setCharacterEncoding("UTF-8");
	String mobile_version= request.getParameter("mobile_version");
	String mobile_name = request.getParameter("mobile_name");
	String mMobile_made = request.getParameter("mMobile_made");
	String mobile_price = request.getParameter("mobile_price");
	String mobile_mess= request.getParameter("mobile_mess");
	String mobile_pic= request.getParameter("mobile_pic");
	String id = request.getParameter("id");
	String sqlQuery = "INSERT INTO `mobileshop`.`mobileForm` (`mobile_version`, `mobile_name`, `mMobile_made`, `mobile_price`, `mobile_mess`, `mobile_pic`, `id`) VALUES (?, ?, ?, ?, ?,?,?)";
	String sqlid = "SELECT * FROM mobileshop.mobileForm where mobile_version='"+mobile_version+"'";
	Connection con = null;
	Statement stat = null;
	ResultSet rs = null;
	PreparedStatement ps = null;
	try{
		Class.forName("com.mysql.cj.jdbc.Driver");
		String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
		con = DriverManager.getConnection(URL);
		stat = con.createStatement();
		rs = stat.executeQuery(sqlid);
		
		if(rs.next()){
			out.print("<script type='text/javascript'>alert('手机产品标识号重复!请重新输入!');window.location.href = document.referrer;</script>");
		}else{
			ps = con.prepareStatement(sqlQuery);
			ps.setString(1,mobile_version);
			ps.setString(2,mobile_name);
			ps.setString(3,mMobile_made);
			ps.setString(4,mobile_price);
			ps.setString(5,mobile_mess);
			ps.setString(6,mobile_pic);
			ps.setString(7,id);
			ps.executeUpdate();
			out.print("<script type='text/javascript'>alert('添加手机信息成功!');window.location.href='MobileMenu.jsp?pages=1';</script>");
			ps.close();
		}
		rs.close();
		stat.close();
		con.close();
	}catch (Exception e){
			e.printStackTrace();
		}
		
		
%>
</body>
</html>

8.AlertMobile.jsp代码如下。更新手机信息。

<%@page import="org.omg.CORBA.Request"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<!-- Bootstrap CSS -->
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
		<!-- Optional JavaScript -->
		<!-- jQuery first, then Popper.js, then Bootstrap JS -->
		<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
		<title>Insert title here</title>
		<style type="text/css">
			.form-control {
				width: 300px;
				height: 30px;
				float: right;
			}
			
			select {
				width: 210px;
				height: 30px;
			}
			
			.submit {
				margin-left: 100px;
				margin-right: 30px;
			}
			
			.contain {
				width: 1000px;
				border: 1px #bbb solid;
				background-color: pink;
				padding-top: 20px;
				border-radius: 10px;
			}
			
			label {
				display: inline-block;
				width: 100px;
				margin-right: 10px;
			}
			
			form {
				margin-left: 300px;
			}
		</style>
	<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>

	<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-3" data-genuitec-path="/MobilePhoneSystem/WebContent/AlertMobile.jsp">
	<%!
	String sourceId;
	String mobile_version;
	String mobile_name;
	String mMobile_made;
	String mobile_price;
	String mobile_mess;
	String mobile_pic;
	String id;
	%>
	<%
	
		if((String)session.getAttribute("logname")==null){
			out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
		}
	
		request.setCharacterEncoding("UTF-8");
		mobile_version= request.getParameter("mobile_version");
		String sqlid = "SELECT * FROM mobileshop.mobileForm where mobile_version='"+mobile_version+"'";
		sourceId = mobile_version;
		try{
			Class.forName("com.mysql.cj.jdbc.Driver");
			String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
			Connection con = DriverManager.getConnection(URL);
			Statement sql = con.createStatement();
			ResultSet rs = sql.executeQuery(sqlid);
			if(rs.next()){
				mobile_version=rs.getString(1);
				mobile_name = rs.getString(2);
				mMobile_made= rs.getString(3);
				mobile_price = rs.getString(4);
				mobile_mess = rs.getString(5);
				mobile_pic= rs.getString(6);
				id = rs.getString(7);
			}
			rs.close();
			sql.close();
			con.close();
		}catch(Exception e){
			e.printStackTrace();
		}
		
	%>
		<div class="contain" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-3" data-genuitec-path="/MobilePhoneSystem/WebContent/AlertMobile.jsp">
			<form action="ToAlertMobile.jsp?sourceId='<%=sourceId %>'" method="post">
				<div class="form-group form-inline">
					<label for="mobile_version">标识号:</label>
				<input type="text" class="form-control" id="mobile_version" name="mobile_version" value='<%=mobile_version %>' required="required">
				</div>
			<div class="form-group form-inline">
				<label for="mobile_name">手机名称:</label>
					<input type="text" class="form-control" id="mobile_name" name="mobile_name" maxlength="15" value='<%=mobile_name %>' required="required">
				</div>
				<div class="form-group form-inline">
				<label for="mMobile_made">手机厂商:</label>
					<input type="text" class="form-control" id="mMobile_made" name="mMobile_made" maxlength="15" value='<%=mMobile_made %>' required="required">
				</div>
				<div class="form-group form-inline">
					<label for="mobile_price">手机价格:</label>
					<input type="text" class="form-control" id="mobile_price" name="mobile_price" value='<%=mobile_price %>' required="required">
				</div>
				<div class="form-group form-inline">
					<label for="mobile_mess">手机简介:</label>
					<input type="text" class="form-control" id="mobile_mess" name="mobile_mess" value='<%=mobile_mess%>' required="required">
				</div>
				<div class="form-group form-inline">
					<label for="mobile_pic">手机模型图:</label>
					<input type="text" class="form-control" id="mobile_pic" name="mobile_pic" value='<%=mobile_pic %>' required="required">
				</div>
				<div class="form-group form-inline">
					<label for="id">手机分类号:</label>
					<input type="text" class="form-control" id="id" name="id" value='<%=id %>' required="required">
				</div>
				<div class="form-group form-inline">
					<input type="submit" id="" name="" class="btn btn-primary submit" value='修改' /><input type="reset" class="btn btn-warning" value="重置" />
				</div>
			</form>
		</div>
	</body>
</html>

 

ToAlertMobile.jsp代码如下。连接数据库更新手机信息。

<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.Statement"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
<title>Insert title here</title>
<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-11" data-genuitec-path="/MobilePhoneSystem/WebContent/ToAlertMobile.jsp">
<%
	//修改学生资料

	if((String)session.getAttribute("logname")==null){
		out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
	}

	request.setCharacterEncoding("UTF-8");
	String sourceId = request.getParameter("sourceId");
	sourceId = sourceId.substring(1, sourceId.length()-1);//由于传值过来会被''括住,需要去除
	String mobile_version= request.getParameter("mobile_version");
	String mobile_name = request.getParameter("mobile_name");
	String mMobile_made = request.getParameter("mMobile_made");
	String mobile_price = request.getParameter("mobile_price");
	String mobile_mess= request.getParameter("mobile_mess");
	String mobile_pic= request.getParameter("mobile_pic");
	String id = request.getParameter("id");
	String sqlQuery = "UPDATE `mobileshop`.`mobileForm` SET `mobile_version` = ?, `mobile_name` = ?, `mMobile_made` = ?, `mobile_price` = ?, `mobile_mess` = ?, `mobile_pic` = ?, `id` = ? WHERE (`mobile_version` = ?)";
	String sqlid = "SELECT * FROM mobileshop.mobileForm where mobile_version='"+mobile_version+"'";
	Connection con = null;
	Statement stat = null;
	ResultSet rs = null;
	PreparedStatement ps = null;
	boolean flag = true;
	try{
		Class.forName("com.mysql.cj.jdbc.Driver");
		String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
		con = DriverManager.getConnection(URL);
		stat = con.createStatement();
		rs = stat.executeQuery(sqlid);	
		if(sourceId.equals(mobile_version)){
			flag = false;
		}
		/*//out.print(flag);
		out.print("<br/>"+sourceId);
		out.print("<br/>"+id);*/
		if(rs.next() && flag){
			out.print("<script type='text/javascript'>alert('标识号重复!请重新输入!');window.location.href = document.referrer;</script>");
		}else{
			ps = con.prepareStatement(sqlQuery);
			ps.setString(1,mobile_version);
			ps.setString(2,mobile_name);
			ps.setString(3,mMobile_made);
			ps.setString(4,mobile_price);
			ps.setString(5,mobile_mess);
			ps.setString(6,mobile_pic);
			ps.setString(7,id);
			ps.setString(8,sourceId);
			ps.executeUpdate();
			out.print("<script type='text/javascript'>alert('更改手机信息成功!');window.location.href='MobileMenu.jsp?pages=1';</script>");
			ps.close();
		}
		rs.close();
		stat.close();
		con.close();
	}catch (Exception e){
			e.printStackTrace();
		}
		
		
%>
</body>
</html>

9.DeleteMobile.jsp代码如下。删除手机信息。

<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
<title>Insert title here</title>
<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-13" data-genuitec-path="/MobilePhoneSystem/WebContent/DeleteMobile.jsp">
<% 

	//删除手机资料
	if((String)session.getAttribute("logname")==null){
		out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
	}

	request.setCharacterEncoding("UTF-8");
	String mobile_version = request.getParameter("mobile_version");
	String sql = "DELETE FROM `mobileshop`.`mobileForm` WHERE (`mobile_version` = ?)";
	Connection con = null;
	PreparedStatement ps = null;
	try{
		String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
		con = DriverManager.getConnection(URL);
		ps = con.prepareStatement(sql);
		ps.setString(1,mobile_version);
		ps.executeUpdate();
		out.print("<script type='text/javascript'>alert('删除手机信息成功!');window.location.href='Contain.jsp?pages=1';</script>");
		ps.close();
		con.close();
	}catch(Exception e){
		e.printStackTrace();
	}
	
%>
</body>
</html>

10.OrderMenu.jsp代码如下。可以实现订单的增删查改。

<%@page import="java.sql.SQLException"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<!-- Bootstrap CSS -->
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
		<!-- Optional JavaScript -->
		<!-- jQuery first, then Popper.js, then Bootstrap JS -->
		<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
		<script type="text/javascript">
			function del() {
				if(!confirm("确认要删除?")) {
					window.event.returnValue = false;
				}
			}
		</script>
		<title>手机后台管理系统</title>
		<style type="text/css">
			body {
				background-color: pink;
				font-family: "黑体";
				
			}
			
			form h1 {
				display: inline-block;
				width: 820px;
			}
			
			.check {
				padding: 30px 30px;
			}
			
			form {
				display: inline;
			}
			
			.contain {
				width: 1000px;
				border-radius: 10px;
				border: 1px #bbb solid;
				background-color: pink;
				padding-top: 20px;
			}
			
			button {
				margin-left: 10px;
			}
			
			.search {
				display: inline-block;
				margin-left: 500px;
			}
			
			.add {
				float: right;
				margin-right: 50px;
			}
			.pageNav{
				margin-left: 200px;
			}
		</style>
	<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>

	<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-6" data-genuitec-path="/MobilePhoneSystem/WebContent/OrderMenu.jsp">
		<%
		request.setCharacterEncoding("UTF-8");
		String pages = request.getParameter("pages");//获取当前页数
		int pagesNo = Integer.parseInt(pages);//把当前页数从字符串转为整型
		int startLine = (Integer.parseInt(pages)-1)*10;//指定数据库从哪一行开始读取
		%>
		<div class="contain pull-left" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-6" data-genuitec-path="/MobilePhoneSystem/WebContent/OrderMenu.jsp">
			<form action="ToSearchOrder.jsp" class="form-inline ">
				<h2>订单信息管理</h2>
				<div class="form-group search">
					<input type="text" name="check" class="form-control" placeholder="请输入需要查询的订单序号" />
					<input type="submit" name="submit"value="搜索" />

				</div>
			</form>
			<a href="AddOrder.jsp" target="_self"><button>添加订单信息</button></a>
			<div class="pull-left">
				<table class="table table-hover">
					<thead>
						<tr>
							<th>订单序号</th>
							<th>用户名</th>
							<th>订单简述</th>
							<th>订单总价</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
<%
	int pageSize = 10;//指定数据库一次读取多少行
	String sqlQuery = "SELECT * FROM mobileshop.orderForm limit "+startLine+","+pageSize;//对数据库进行伪分页读取,一次只能读10行
	String sqlAll = "SELECT * FROM mobileshop.orderForm";
	int pagesCount = 0;//用于数据库最后读出所有行后总共有多少页
	int lastRow = 0;//记录数据库的最后一行
	try{
		Class.forName("com.mysql.cj.jdbc.Driver");
		String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
		Connection con = DriverManager.getConnection(URL);
		Statement sql = con.createStatement();
		Statement stat = con.createStatement();
		ResultSet rs = sql.executeQuery(sqlQuery);
		ResultSet rsAll = stat.executeQuery(sqlAll);
		rsAll.last();
		lastRow = rsAll.getRow();//记录数据库最后一行
		while(rs.next()){
			out.print("<tr>");
			out.print("<td>"+rs.getString(1)+"</td>");
			out.print("<td>"+rs.getString(2)+"</td>");
			out.print("<td>"+rs.getString(3)+"</td>");
			out.print("<td>"+rs.getString(4)+"</td>");
			out.print("<td><a href='AlertOrder.jsp?id="+rs.getString(1)+"'><button>更新</button></a><a href='DeleteOrder.jsp?id="+rs.getString(1)+"' onclick='javascript:return del();'><button>删除</button></a></td>");
			out.print("</tr>");
		}
		con.close();
	}catch(SQLException e){
		e.printStackTrace();
	}
%>

					</tbody>
				</table>
				<div class="pageNav">
					<ul class="pagination">
					<%
						int prePage;//上一页的页数
						if(pagesNo == 1){
							prePage = 1;//若当前页是第一页,则第一页只能是当前页
						}else{
							prePage = pagesNo - 1;//除了上述情况外上一页等于当前页-1页
						}
					%>
					<li class="page-item"><a class="page-link" href="MobileMenu.jsp?pages=<%=prePage%>">上一页</a></li>
					<%
						pagesCount = (lastRow % pageSize == 0) ? (lastRow / pageSize) : (lastRow / pageSize +1);//计算数据库能读出来的全部页数
						int minpages = (pagesNo - 3 >0) ? (pagesNo - 3) : 1;//设定最小页,防止页数小于第一页
						int maxpages = (pagesNo + 3 >= pagesCount) ? (pagesCount) : (pagesNo+3);//设定最大页
						for(int i = minpages;i <=maxpages ;i++){
							if(i == pagesNo){//当前页和遍历出来的页数相等时,需要通过调用css里面的样式“active"进行高亮
								out.print("<li class='page-item active'>");
								out.print("<a class='page-link' href='MobileMenu.jsp?pages="+i+"'>"+i+"</a>");
								out.print("</li>");
							}else{//输出每一个分页
								out.print("<li class='page-item'>");
								out.print("<a class='page-link' href='MobileMenu.jsp?pages="+i+"'>"+i+"</a>");
								out.print("</li>");
							}
							
						}
							//out.print("<li class='page-item'>");
							//out.print("<a class='page-link' href='#>...</a>");
							//out.print("</li>");
						
					%>
					<%
						int nextPage;
						if(pagesNo == pagesCount){//下一页的原理和上一页同理
							nextPage = pagesCount;
						}else{
							nextPage = pagesNo + 1;
						}
					%>
					<li class="page-item"><a class="page-link" href="MobileMenu.jsp?pages=<%=nextPage%>">下一页</a></li>
					</ul>
				</div>

			</div>

		</div>
	</body>

</html>

 

11.ToSearchOrder.jsp代码如下。查找订单。

<%@page import="java.sql.SQLException"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<!-- Bootstrap CSS -->
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
		<!-- Optional JavaScript -->
		<!-- jQuery first, then Popper.js, then Bootstrap JS -->
		<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
		<script type="text/javascript">
			function del() {
				if(!confirm("确认要删除?")) {
					window.event.returnValue = false;
				}
			}
		</script>
		<title>订单信息管理系统</title>
		<style type="text/css">
			body {
				background-color:pink;
				font-family: "黑体";
			}
			
			form h1 {
				display: inline-block;
				width: 820px;
				font-family: "黑体";
			}
			
			.check {
				padding: 30px 30px;
				font-family: "黑体";
			}
			
			form {
				display: inline;
				font-family: "黑体";
			}
			
			.contain {
				width: 1000px;
				border-radius: 10px;
				border: 1px #bbb solid;
				background-color: pink;
				padding-top: 20px;
				font-family: "黑体";
			}
			
			button {
				margin-left: 10px;
				font-family: "黑体";
			}
			
			.search {
				display: inline-block;
				margin-left: 500px;
				font-family: "黑体";
			}
		</style>
	<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>

	<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-16" data-genuitec-path="/MobilePhoneSystem/WebContent/DaoSearch2.jsp">
		<div class="contain pull-left" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-16" data-genuitec-path="/MobilePhoneSystem/WebContent/DaoSearch2.jsp">
			<form action="ToSearchMobile.jsp" class="form-inline ">
				<h2>查询结果</h2>
				<div class="form-group search">
					<input type="text" name="check" class="form-control" placeholder="请输入需要查询的订单序号" />
					<input type="submit" name="submit" value="搜索" />

				</div>
			</form>
			<a href="AddOrder.jsp" target="_self"><button>添加订单信息</button></a>
			<div class="pull-left">
				<table class="table">
					<thead>
						<tr>
							<th>订单序号</th>
							<th>用户名</th>
							<th>订单简述</th>
							<th>订单总价</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
	<%
	//查询功能
	if((String)session.getAttribute("logname")==null){
		out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
	}
	
	request.setCharacterEncoding("UTF-8");
	String search = request.getParameter("check");
	String sqlQuery;
	if(search.matches("[0-9]+")){
		sqlQuery = "SELECT * FROM mobileshop.orderForm where id='"+search+"'";
	}else{
		sqlQuery = "SELECT * FROM mobileshop.orderForm where logname='"+search+"'";
	}
	
	try{
		Class.forName("com.mysql.cj.jdbc.Driver");
		String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
		Connection con = DriverManager.getConnection(URL);
		Statement sql = con.createStatement();
		ResultSet rs = sql.executeQuery(sqlQuery);
		while(rs.next()){
			out.print("<tr>");
			out.print("<td>"+rs.getString(1)+"</td>");
			out.print("<td>"+rs.getString(2)+"</td>");
			out.print("<td>"+rs.getString(3)+"</td>");
			out.print("<td>"+rs.getString(4)+"</td>");
			out.print("<td><a href='AlertOrder.jsp?id="+rs.getString(1)+"'><button>更新</button></a><a href='DeleteOrder.jsp?id="+rs.getString(1)+"' onclick='javascript:return del();'><button>删除</button></a></td>");
			out.print("</tr>");
		}
		con.close();
	}catch(SQLException e){
		e.printStackTrace();
	}
%>

					</tbody>
				</table>
			</div>

		</div>
	</body>

</html>

 

12.AddOrder.jsp代码如下。增加订单。

<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<!-- Bootstrap CSS -->
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
		<!-- Optional JavaScript -->
		<!-- jQuery first, then Popper.js, then Bootstrap JS -->
		<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
		<title>Insert title here</title>
		<style type="text/css">
			.form-control {
				width: 300px;
				height: 30px;
				float: right;
				background-color: pink;
			}
			
			select {
				width: 210px;
				height: 30px;
			}
			
			.submit {
				margin-left: 100px;
				margin-right: 30px;
			}
			
			.contain {
				width: 1000px;
				border: 1px #bbb solid;
				background-color: pink;
				padding-top: 20px;
				border-radius: 10px;
			}
			
			label {
				display: inline-block;
				width: 100px;
				margin-right: 10px;
			}
			
			form {
				margin-left: 300px;
				background-color: pink;
			}
		</style>
	<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>

	<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-1" data-genuitec-path="/MobilePhoneSystem/WebContent/AddOrder.jsp">
	<%
		if((String)session.getAttribute("logname")==null){
			out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
		}//提示登陆,并且在当前页面打开Login.html页面
	%>
		<div class="contain" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-1" data-genuitec-path="/MobilePhoneSystem/WebContent/AddOrder.jsp">
			<form action=ToAddOrder.jsp" method="post">
				<div class="form-group form-inline">
					<label for="id">订单序号:</label>
				<input type="text" class="form-control" id="id" name="id" maxlength="15" required="required" placeholder="请输入你的订单序号:">
				</div>
			<div class="form-group form-inline">
				<label for="logname">用户名:</label>
					<input type="text" class="form-control" id="logname" name="logname" required="required">
				</div>
				<div class="form-group form-inline">
					<label for="mess">订单简介:</label>
					<input type="text" class="form-control" id="mess" name="mess" required="required">
				</div>
				<div class="form-group form-inline">
					<label for="sum">订单总价:</label>
					<input type="text" class="form-control" id="sum" name="sum" required="required">
				</div>
				<div class="form-group form-inline">
					<input type="submit" id="" name=""  value="添加"/><input type="reset" value="重置" />
				</div>
			</form>
		</div>
	</body>
</html>

 

ToAddOrder.jsp代码如下。连接数据库添加订单。

<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.Statement"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
<title>Insert title here</title>
<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-9" data-genuitec-path="/MobilePhoneSystem/WebContent/ToAddOrder.jsp">
<%

	//添加学生资料
	if((String)session.getAttribute("logname")==null){
		out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
	}

	request.setCharacterEncoding("UTF-8");
	String id= request.getParameter("id");
	String logname = request.getParameter("logname");
	String mess = request.getParameter("mess");
	String sum = request.getParameter("sum");
	String sqlQuery = "INSERT INTO `mobileshop`.`orderForm` (`id`, `logname`, `mess`, `sum`) VALUES (?, ?, ?, ?)";
	String sqlid = "SELECT * FROM mobileshop.orderForm where id='"+id+"'";
	Connection con = null;
	Statement stat = null;
	ResultSet rs = null;
	PreparedStatement ps = null;
	try{
		Class.forName("com.mysql.cj.jdbc.Driver");
		String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
		con = DriverManager.getConnection(URL);
		stat = con.createStatement();
		rs = stat.executeQuery(sqlid);
		
		if(rs.next()){
			out.print("<script type='text/javascript'>alert('订单号重复!请重新输入!');window.location.href = document.referrer;</script>");
		}else{
			ps = con.prepareStatement(sqlQuery);
			ps.setString(1,id);
			ps.setString(2,logname);
			ps.setString(3,mess);
			ps.setString(4,sum);
			ps.executeUpdate();
			out.print("<script type='text/javascript'>alert('添加订单信息成功!');window.location.href='OrderMenu.jsp?pages=1';</script>");
			ps.close();
		}
		rs.close();
		stat.close();
		con.close();
	}catch (Exception e){
			e.printStackTrace();
		}
		
		
%>
</body>
</html>

13.DeleteOrder.jsp代码如下。删除订单。

<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
<title>Insert title here</title>
<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-14" data-genuitec-path="/MobilePhoneSystem/WebContent/DeleteOrder.jsp">
<% 

	//删除学生资料
	if((String)session.getAttribute("logname")==null){
		out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
	}

	request.setCharacterEncoding("UTF-8");
	String id = request.getParameter("id");
	String sql = "DELETE FROM `mobileshop`.`orderForm` WHERE (`id` = ?)";
	Connection con = null;
	PreparedStatement ps = null;
	try{
		String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
		con = DriverManager.getConnection(URL);
		ps = con.prepareStatement(sql);
		ps.setString(1,id);
		ps.executeUpdate();
		out.print("<script type='text/javascript'>alert('删除订单信息成功!');window.location.href='Contain2.jsp?pages=1';</script>");
		ps.close();
		con.close();
	}catch(Exception e){
		e.printStackTrace();
	}
	
%>
</body>
</html>

14.AlertOrder.jsp代码如下。更改订单。

<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<!-- Bootstrap CSS -->
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
		<!-- Optional JavaScript -->
		<!-- jQuery first, then Popper.js, then Bootstrap JS -->
		<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
		<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
		<title>Insert title here</title>
		<style type="text/css">
			.form-control {
				width: 300px;
				height: 30px;
				float: right;
			}
			
			select {
				width: 210px;
				height: 30px;
			}
			
			.submit {
				margin-left: 100px;
				margin-right: 30px;
			}
			
			.contain {
				width: 1000px;
				border: 1px #bbb solid;
				background-color: pink;
				padding-top: 20px;
				border-radius: 10px;
			}
			
			label {
				display: inline-block;
				width: 100px;
				margin-right: 10px;
			}
			
			form {
				margin-left: 300px;
			}
		</style>
	<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>

	<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-4" data-genuitec-path="/MobilePhoneSystem/WebContent/AlertOrder.jsp">
	<%!
	String sourceId;
	String id;
	String logname;
	String mess;
	String sum;
	%>
	<%
	
		if((String)session.getAttribute("logname")==null){
			out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
		}
	
		request.setCharacterEncoding("UTF-8");
		id = request.getParameter("id");
		String sqlid = "SELECT * FROM mobileshop.orderForm where id='"+id+"'";
		sourceId = id;
		try{
			Class.forName("com.mysql.cj.jdbc.Driver");
			String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
			Connection con = DriverManager.getConnection(URL);
			Statement sql = con.createStatement();
			ResultSet rs = sql.executeQuery(sqlid);
			if(rs.next()){
				id = rs.getString(1);
				logname = rs.getString(2);
				mess= rs.getString(3);
				sum = rs.getString(4);
				
				
			}
			rs.close();
			sql.close();
			con.close();
		}catch(Exception e){
			e.printStackTrace();
		}
		
	%>
		<div class="contain" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-4" data-genuitec-path="/MobilePhoneSystem/WebContent/AlertOrder.jsp">
			<form action="ToAlertOrder.jsp?sourceId='<%=sourceId %>'" method="post">
				<div class="form-group form-inline">
					<label for="id">订单号:</label>
				<input type="text" class="form-control" id="id" name="id" value='<%=id %>' required="required">
				</div>
			<div class="form-group form-inline">
				<label for="logname">用户名:</label>
					<input type="text" class="form-control" id="logname" name="logname" maxlength="15" value='<%=logname %>' required="required">
				</div>
				<div class="form-group form-inline">
				<label for="mess">订单简述:</label>
					<input type="text" class="form-control" id="mess" name="mess" maxlength="15" value='<%=mess %>' required="required">
				</div>
				<div class="form-group form-inline">
					<label for="sum">订单总价:</label>
					<input type="text" class="form-control" id="sum" name="sum" value='<%=sum %>' required="required">
				</div>
				<div class="form-group form-inline">
					<input type="submit" id="" name="" value='修改' /><input type="reset"  value="重置" />
				</div>
			</form>
		</div>
	</body>
</html>

ToAlertOrder.jsp代码如下。连接数据库更改数据。

<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.Statement"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
<title>Insert title here</title>
<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-12" data-genuitec-path="/MobilePhoneSystem/WebContent/ToAlertOrder.jsp">
<%
	//修改学生资料

	if((String)session.getAttribute("logname")==null){
		out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
	}

	request.setCharacterEncoding("UTF-8");
	String id = request.getParameter("id");
	String sourceId = request.getParameter("sourceId");
	sourceId = sourceId.substring(1, sourceId.length()-1);//由于传值过来会被''括住,需要去除
	String  logname=request.getParameter("logname");
	String mess=request.getParameter("mess");
	String sum=request.getParameter("sum");
	String sqlQuery = "UPDATE `mobileshop`.`orderForm` SET `id` = ?, `logname` = ?, `mess` = ?, `sum` = ? WHERE (`id` = ?)";
	String sqlid = "SELECT * FROM mobileshop.orderForm where id='"+id+"'";
	Connection con = null;
	Statement stat = null;
	ResultSet rs = null;
	PreparedStatement ps = null;
	boolean flag = true;
	try{
		Class.forName("com.mysql.cj.jdbc.Driver");
		String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
		con = DriverManager.getConnection(URL);
		stat = con.createStatement();
		rs = stat.executeQuery(sqlid);
		if(sourceId.equals(id)){
			flag = false;
		}
		
		if(rs.next() && flag){
			out.print("<script type='text/javascript'>alert('订单序号重复!请重新输入!');window.location.href = document.referrer;</script>");
		}else{
			ps = con.prepareStatement(sqlQuery);
			ps.setString(1,id);
			ps.setString(2,logname);
			ps.setString(3,mess);
			ps.setString(4,sum);
			ps.setString(5,sourceId);
			ps.executeUpdate();
			out.print("<script type='text/javascript'>alert('修改订单信息成功!');window.location.href='OrderMenu.jsp?pages=1';</script>");
			ps.close();
		}
		rs.close();
		stat.close();
		con.close();
	}catch (Exception e){
			e.printStackTrace();
		}
		
		
%>
</body>
</html>

 

15.AdminPasswordReset.jsp代码如下。更改管理员信息。

<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<title>Insert title here</title>
<style type="text/css">
	.container{
		width: 1000px;
		border: 1px #bbb solid;
		background-color:pink;
		padding-top: 20px;
		border-radius: 10px;
		float: left;
	}
	.form-control{
		width: 300px;
		height: 30px;
	}
	form {
		margin-left: 300px;
	}
	.submit{
		margin-left: 50px;
	}
	.reset{
		margin-left: 50px;
	}
</style>
<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-2" data-genuitec-path="/MobilePhoneSystem/WebContent/AdminPasswordReset.jsp">
	<%
	if((String)session.getAttribute("logname")==null){
		out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
	}
	%>
<div class="container" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-2" data-genuitec-path="/MobilePhoneSystem/WebContent/AdminPasswordReset.jsp">
  <h2>管理员账户密码修改</h2>
  <form action="ToAdminPasswordReset.jsp" method="post">
    <div class="form-group">
      <label for="logname">用户名</label>
      <input type="email" class="form-control" id="logname" name="logname"  readonly="readonly" value="<%= session.getAttribute("logname")%>">
    </div>
    <div class="form-group">
      <label for="pwd">密码</label>
      <input type="password" class="form-control" id="pwd" name="pwd" placeholder="请输入新的密码">
    </div>
    <button type="submit"  >修改</button>
    <input type="reset"  id="reset" value="重置" />
  </form>
</div>
</body>
</html>

 

ToAdminPasswordReset.jsp代码如下。连接数据库更新管理员信息。

<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
<title>Insert title here</title>
<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-10" data-genuitec-path="/MoblePhoneSystem/WebContent/ToAdminPasswordReset.jsp">
<%
	//修改管理员的密码
	String logname = session.getAttribute("logname").toString();
	String realname = session.getAttribute("realname").toString();
	String passowrd = request.getParameter("pwd");
	String sql = "UPDATE `mobileshop`.`user` SET `password` = ? WHERE (`realname` = ?)";
	Connection con = null;
	PreparedStatement ps = null;
	try{
		Class.forName("com.mysql.cj.jdbc.Driver");
		String URL = "jdbc:mysql://127.0.0.1:3306/mobileshop?useSSL=false&user=root&password=123456&serverTimezone=GMT%2B8";
		con = DriverManager.getConnection(URL);
		ps = con.prepareStatement(sql);
		ps.setString(1, passowrd);
		ps.setString(2, realname);
		ps.executeUpdate();
		ps.close();
		con.close();
		session.removeAttribute("realname");//移除用户会话
		session.removeAttribute("logname");
		out.print("<script type='text/javascript'>alert('更改密码成功!请重新登录!');window.parent.frames.location.href='Login.html';</script>");
	}catch(Exception e){
		e.printStackTrace();
	}
%>
</body>
</html>

 

16.SyatemExit.jsp代码如下。退出系统,重返登陆页面。

<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
<title>Insert title here</title>
<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-21" data-genuitec-path="/MobilePhoneSystem/WebContent/SystemExit.jsp">
<%
if((String)session.getAttribute("logname")==null){
	out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
}
%>
<%
	//用户退出登录时移除会话
	session.removeAttribute("logname");
	session.removeAttribute("password");
	out.print("<script type='text/javascript'>alert('用户退出成功!');window.location.href='Login.html';</script>");
%>
</body>
</html>

 

17.LeftMenu.html代码如下,显示左边菜单。

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
		<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
		<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
		<style type="text/css">
			ul{
				width: 150px;
				height: 200px;
				float: right;
				margin-top: 100px;
				
			}
		</style>
	<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
	<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-17" data-genuitec-path="/MobilePhoneSystem/WebContent/LeftMenu.html">
	<ul class="nav nav-tabs" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-17" data-genuitec-path="/MobilePhoneSystem/WebContent/LeftMenu.html">
   <!-- <li class="active"><a href="#">Home</a></li>
     -->
    <li class="dropdown">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#">后台管理系统
            <span class="caret"></span></a>
        <ul class="dropdown-menu">
           <li><a href="MobileMenu.jsp?pages=1" target="contain">手机信息管理</a></li>
			<li><a href="OrderMenu.jsp?pages=1" target="contain">手机订单管理</a></li>
			<li><a href="AdminPasswordReset.jsp" target="contain">管理员账号密码重置</a></li>
        </ul>
    </li>
     <li>
        <a href="SystemExit.jsp" target="_parent">退出后台管理系统</a></li>
</ul>

	</body>
</html>

 

18.TopMenu.html代码如下。显示顶层菜单。

<%@ page language="java" contentType="text/html; charset=UTF-8"
    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=UTF-8">
<title>Insert title here</title>
<style type="text/css">
	.block{
		width: 1300px;
		height: 50px;
		background-color: pink;
		border-radius: 10px;
		margin: 0 auto;
	}
	h3{
		text-align: center;
		padding-top: 15px;
		font-family: "黑体";
	}
</style>
<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"52136",secure:"52141"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-22" data-genuitec-path="/MobilePhoneSystem/WebContent/Top.jsp">
	<div class="block" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc2-22" data-genuitec-path="/MobilePhoneSystem/WebContent/Top.jsp">
		<%
			if((String)session.getAttribute("logname")==null){
				out.print("<script language='JavaScript'>alert('请先登录!');window.location.href='Login.html'</script>");
				//如果检查到没有用户登陆,则重定向至主登陆页面
			}
		%>
		<h3>您好!<%=(String)session.getAttribute("realname") %>管理员,欢迎来到后台管理系统</h3>
	</div>
</body>
</html>

 

四、总结

整个编程思路要十分清晰。开始的时候很混乱,后来用心理解、分析各个页面的逻辑和结构,就能构思出大概的框架。有些知识掌握不够牢固,需要向人求助、上网求助才能解决问题。有出现过订单查询不了(即没有数据显示)的问题,找了两个小时错误,最终发现是action里的目标页面的大写写成了小写,更改后成功运行。由于在编写前端程序时,在数据库连接方面碰过壁,使用了Class.forName("com.mysql.cj.jdbc.Driver");,没有出现乱码问题。连接数据库语句中也加上了&serverTimezone=GMT%2B8语句,没有出现区时性的错误。

IT行业进步太快,需不断努力学习,提升学习水平,才能不断进步,为社会做出贡献。

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值