Explorar o código

上传文件至 'WebRoot'

1801010627 %!s(int64=5) %!d(string=hai) anos
pai
achega
05c8649e18
Modificáronse 5 ficheiros con 471 adicións e 0 borrados
  1. 69 0
      WebRoot/change.jsp
  2. 69 0
      WebRoot/input.jsp
  3. 110 0
      WebRoot/succChan.jsp
  4. 105 0
      WebRoot/succDele.jsp
  5. 118 0
      WebRoot/test2.html

+ 69 - 0
WebRoot/change.jsp

@@ -0,0 +1,69 @@
+<%@ page language="java" contentType="text/html; charset=utf-8"
+pageEncoding="utf-8"%>
+<%-- <% request.setCharacterEncoding("utf-8") ;%> --%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<%-- <%
+int id = Integer.parseInt(request.getParameter("id"));
+int rootid = Integer.parseInt(request.getParameter("rootid"));
+
+%> --%>
+
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>输入信息</title>
+<style type="text/css">
+	form{
+		margin-top: 100px;
+		color:red;
+	}
+	input{
+		width:220px;
+		height: 30px;
+	}
+	.sub:hover{
+		background-color:#13954A;
+		border: none;
+	}
+	h1{
+		text-align:center;
+		font-size:24px;
+		color:skyblue;
+	}
+	.main{
+		border-radius: 20px;
+		width: 150px;
+		height: 40px;
+		text-align: center;
+		font-size: 28px;
+		text-decoration: none;
+		border: solid;
+		display: block;
+		position: absolute;
+		top: 85%;
+		right: 8%;
+	}
+	.main:hover{
+		background-color: skyblue;
+	}
+</style>
+</head>
+<body>
+<h1>请输入修改的信息</h1>
+<form method="post" action="succChan.jsp" align="center">
+设备名称:<input type="text" name="name" ><br><br>
+数量:<input type="text" name="calssGrent"><br><br>
+价格 : <input type="text" name="result" ><br><br>
+<table align="center">
+
+<tr>
+<td>
+<input type="submit" value="提交" class="sub">
+</td>
+</tr>
+</table>
+</form>
+<a href="test2.html" class="main">返回主页</a>
+</body>
+</html>
+</html>

+ 69 - 0
WebRoot/input.jsp

@@ -0,0 +1,69 @@
+<%@ page language="java" contentType="text/html; charset=utf-8"
+pageEncoding="utf-8"%>
+<%-- <% request.setCharacterEncoding("utf-8") ;%> --%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<%-- <%
+int id = Integer.parseInt(request.getParameter("id"));
+int rootid = Integer.parseInt(request.getParameter("rootid"));
+
+%> --%>
+
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>输入信息</title>
+<style type="text/css">
+	form{
+		margin-top: 100px;
+		color:red;
+	}
+	input{
+		width:220px;
+		height: 30px;
+	}
+	.sub:hover{
+		background-color:#13954A;
+		border: none;
+	}
+	.main{
+		border-radius: 20px;
+		width: 150px;
+		height: 40px;
+		text-align: center;
+		font-size: 28px;
+		text-decoration: none;
+		border: solid;
+		display: block;
+		position: absolute;
+		top: 85%;
+		right: 8%;
+	}
+	.main:hover{
+		background-color: skyblue;
+	}
+		h1{
+		text-align:center;
+		font-size:24px;
+		color:skyblue;
+	}
+</style>
+</head>
+<body>
+<h1>请输入添加的信息</h1>
+<form method="post" action="http://localhost:8080/devicemanagement/Add" align="center">
+设备名称:<input type="text" name="name" ><br><br>
+数量:<input type="text" name="grent"><br><br>
+价格 : <input type="text" name="result" ><br><br>
+<table align="center">
+
+<tr>
+<td>
+<input type="submit" value="提交" class="sub">
+</td>
+</tr>
+</table>
+</form>
+<a href="test2.html" class="main">返回主页</a>
+</body>
+</html>
+</html>

+ 110 - 0
WebRoot/succChan.jsp

@@ -0,0 +1,110 @@
+<%@ page language="java" contentType="text/html; charset=utf-8"%>
+<%@ page import="java.sql.*"%>
+<% request.setCharacterEncoding("utf-8") ;%>
+<%-- <%@ page import="com.mchange.v2.c3p0.ComboPooledDataSource" %> --%>
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Insert title here</title>
+</head>
+<body>
+	<% 
+ 	 Class.forName("com.mysql.jdbc.Driver"); 
+	String url = "jdbc:mysql://localhost:3306/kui"; //指向数据库table1
+	String username = "root";  
+	String password = "001011";  
+	Connection conn = null;
+	conn = DriverManager.getConnection(url, username, password);
+	
+	if(conn != null){  
+	/* Statement stmt = conn.createStatement(); */
+	String result=request.getParameter("result"); 
+	String name=request.getParameter("name"); 
+	String calssGrent=request.getParameter("calssGrent");
+	
+	if(calssGrent.equals("")|name.equals("")|result.equals("")){
+	response.sendRedirect("dele.jsp");
+	}else{
+	
+	 Statement stmt = null;  
+		ResultSet rs = null;
+		   PreparedStatement pstmt = null;  
+	 //String sql = "insert into title(id,name,sex) values('"+id+"','"+name+"','"+sex+"')"; 
+	//String sql = "INSERT INTO title (id,name,age,gender) " 
+                   //+"VALUES (880,'菜菜',12,'女')"; 
+                    
+ 
+ String sql = "update student set calssGrent='" + calssGrent +"',result='"+result+ "' where name='" + name + "'";
+
+		 pstmt = conn.prepareStatement(sql);
+
+			pstmt.executeUpdate();
+                    
+                    
+			out.print("<style type=\"text/css\">\r\n" + 
+	    	  		"	@keyframes move{\r\n" + 
+	    	  		"		0%{\r\n" + 
+	    	  		"			color:pink;\r\n" + 
+	    	  		"		}\r\n" + 
+	    	  		"		20%{\r\n" + 
+	    	  		"			color:skyblue;\r\n" + 
+	    	  		"		}\r\n" + 
+	    	  		"		40%{\r\n" + 
+	    	  		"			color:red;\r\n" + 
+	    	  		"		}\r\n" + 
+	    	  		"		60%{\r\n" + 
+	    	  		"			color:blue;\r\n" + 
+	    	  		"		}\r\n" + 
+	    	  		"		80%{\r\n" + 
+	    	  		"			color:green;\r\n" + 
+	    	  		"		}\r\n" + 
+	    	  		"		90%{\r\n" + 
+	    	  		"			color:gold;\r\n" + 
+	    	  		"		}\r\n" + 
+	    	  		"	}\r\n" + 
+	    	  		"	h1{\r\n" + 
+	    	  		"		animation-name: move;\r\n" + 
+	    	  		"		animation-duration: 10s;\r\n" + 
+	    	  		"		text-align: center;\r\n" + 
+	    	  		"	}\r\n" + 
+	    	  		"	a{\r\n" + 
+	    	  		"		text-align: center;\r\n" + 
+	    	  		"		font-size: 28px;\r\n" + 
+	    	  		"		text-decoration: none;\r\n" + 
+	    	  		"	}\r\n" + 
+	    	  		"	.look{\r\n" + 
+	    	  		"		width: 180px;\r\n" + 
+	    	  		"		height: 40px;\r\n" + 
+	    	  		"		border: solid;\r\n" + 
+	    	  		"		margin: 0 auto;\r\n" + 
+	    	  		"		text-align: center;\r\n" + 
+	    	  		"	}\r\n" + 
+	    	  		"	.look:hover{\r\n" + 
+	    	  		"		background-color: pink;\r\n" + 
+	    	  		"	}\r\n" + 
+	    	  		"	</style>");
+	        out.println("<h1>恭喜!修改成功!</h1><br><br>"); 
+	        out.println("<div class=\"look\">\r\n" + 
+	        		"	<a href=MMC_01>查看列表</a>\r\n" + 
+	        		"	</div>"); 
+	 
+	/* name=new String(name.getBytes("utf-8"));
+	out.print(name); */ 
+ //	rs.next();
+		
+	
+} 
+	}
+	else{  
+		out.print("连接失败!");  
+          }           
+    
+	
+	
+	%>
+	<br><br>
+	<!-- <a href="Student.jsp"> 返回管理首页</a> -->
+	
+</body>
+</html>

+ 105 - 0
WebRoot/succDele.jsp

@@ -0,0 +1,105 @@
+<%@ page language="java" contentType="text/html; charset=utf-8"%>
+<%@ page import="java.sql.*"%>
+<% request.setCharacterEncoding("utf-8") ;%>
+<%-- <%@ page import="com.mchange.v2.c3p0.ComboPooledDataSource" %> --%>
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Insert title here</title>
+</head>
+<body>
+	<% 
+	 Class.forName("com.mysql.jdbc.Driver");
+	String url = "jdbc:mysql://localhost:3306/kui"; //指向数据库table1
+	String username = "root";  
+	String password = "001011";  
+	Connection conn = null;
+	conn = DriverManager.getConnection(url, username, password);
+	
+	if(conn != null){  
+	/* Statement stmt = conn.createStatement(); */
+
+	String name=request.getParameter("name"); 
+
+	
+	if(name.equals("")){
+	response.sendRedirect("dele.jsp");
+	}else{
+	
+	 Statement stmt = null;  
+		ResultSet rs = null;
+		   PreparedStatement pstmt = null;  
+
+                    
+        String sql = "delete from student  where name='"+name+"' ";
+
+		 pstmt = conn.prepareStatement(sql);
+
+	
+
+			pstmt.executeUpdate();
+                    
+                    
+			out.print("<style type=\"text/css\">\r\n" + 
+	    	  		"	@keyframes move{\r\n" + 
+	    	  		"		0%{\r\n" + 
+	    	  		"			color:pink;\r\n" + 
+	    	  		"		}\r\n" + 
+	    	  		"		20%{\r\n" + 
+	    	  		"			color:skyblue;\r\n" + 
+	    	  		"		}\r\n" + 
+	    	  		"		40%{\r\n" + 
+	    	  		"			color:red;\r\n" + 
+	    	  		"		}\r\n" + 
+	    	  		"		60%{\r\n" + 
+	    	  		"			color:blue;\r\n" + 
+	    	  		"		}\r\n" + 
+	    	  		"		80%{\r\n" + 
+	    	  		"			color:green;\r\n" + 
+	    	  		"		}\r\n" + 
+	    	  		"		90%{\r\n" + 
+	    	  		"			color:gold;\r\n" + 
+	    	  		"		}\r\n" + 
+	    	  		"	}\r\n" + 
+	    	  		"	h1{\r\n" + 
+	    	  		"		animation-name: move;\r\n" + 
+	    	  		"		animation-duration: 10s;\r\n" + 
+	    	  		"		text-align: center;\r\n" + 
+	    	  		"	}\r\n" + 
+	    	  		"	a{\r\n" + 
+	    	  		"		text-align: center;\r\n" + 
+	    	  		"		font-size: 28px;\r\n" + 
+	    	  		"		text-decoration: none;\r\n" + 
+	    	  		"	}\r\n" + 
+	    	  		"	.look{\r\n" + 
+	    	  		"		width: 180px;\r\n" + 
+	    	  		"		height: 40px;\r\n" + 
+	    	  		"		border: solid;\r\n" + 
+	    	  		"		margin: 0 auto;\r\n" + 
+	    	  		"		text-align: center;\r\n" + 
+	    	  		"	}\r\n" + 
+	    	  		"	.look:hover{\r\n" + 
+	    	  		"		background-color: pink;\r\n" + 
+	    	  		"	}\r\n" + 
+	    	  		"	</style>");
+	        out.println("<h1>恭喜!删除成功!</h1><br><br>"); 
+	        out.println("<div class=\"look\">\r\n" + 
+	        		"	<a href=MMC_01>查看列表</a>\r\n" + 
+	        		"	</div>"); 
+
+	
+} 
+	}
+	else{  
+		out.print("连接失败!");  
+          }           
+    
+	
+	
+	%>
+	<br><br>
+	<!-- <a href="Student.jsp"> 返回管理首页</a> -->
+	
+</body>
+</html>

+ 118 - 0
WebRoot/test2.html

@@ -0,0 +1,118 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="UTF-8">
+	<title>欢迎来到设备管理系统</title>
+	<style type="text/css">
+	body{
+		background-color: skyblue;
+	}
+	.welcome{
+		font-size: 28px;
+		color:#961515;
+		font-style: italic;
+	}
+	.select{
+		font-size: 28px;
+		text-align: center;
+		margin-top: 80px;
+		color:#A75480;
+	}
+	@keyframes move{
+		0%{
+			color:pink;
+		}
+		20%{
+			color:skyblue;
+		}
+		40%{
+			color:#C4B3B3;
+		}
+		60%{
+			color:blue;
+		}
+		80%{
+			color:green;
+		}
+		90%{
+			color:gold;
+		}
+	}
+
+	.select{
+		animation-name: move;
+		animation-duration: 15s;
+	}
+	.do{
+		width: 980px;
+		height: 280px;
+		/*background-color: #C4B3B3;*/
+		margin: 70px auto;
+	}
+	.do1{
+		width: 180px;
+		height: 250px;
+		margin: 30px;
+		float: left;
+		background-color: #C4B3B3;
+		text-align: center;
+		line-height: 250px;
+	}
+	.do2{
+		width: 180px;
+		height: 250px;
+		margin: 30px;
+		float: left;
+		background-color: #C4B3B3;
+		text-align: center;
+		line-height: 250px;
+	}
+	.do3{
+		width: 180px;
+		height: 250px;
+		margin: 30px;
+		float: left;
+		background-color: #C4B3B3;
+		text-align: center;
+		line-height: 250px;
+	}
+	.do4{
+		width: 180px;
+		height: 250px;
+		margin: 30px;
+		float: left;
+		background-color: #C4B3B3;
+		text-align: center;
+		line-height: 250px;
+	}
+	a{
+		text-decoration: none;
+		color:#0A62C0;
+		font-size: 24px;
+	}
+	.do>a:hover{
+		background-color: pink;
+	}
+
+	</style>
+</head>
+<body>
+	<marquee behavior="scroll" direction="right">
+	<div class="welcome">
+	欢迎来到设备管理系统!
+	</div>
+	</marquee>
+	<div class="select">
+	请选择操作
+	</div>
+	
+	<div class="do">
+	<a class="do1" href="http://localhost:8080/devicemanagement/input.jsp">添加数据</a>
+	<a class="do2" href="http://localhost:8080/devicemanagement/dele.jsp">删除数据</a>
+	<a class="do3" href="http://localhost:8080/devicemanagement/change.jsp">修改数据</a>
+	<a class="do4" href="http://localhost:8080/devicemanagement/MMC_01">查询数据</a>
+	</div>
+
+	</marquee>
+</body>
+</html>