JSP图书管理系统代码

相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
font-size: 36px; font-weight: bold; } --> </style> </head> <body> <form name="form1" method="post" action="valid.jsp"> <table width="400" height="120" border="1" align="center"> <caption>
for(int i = 0;i<ids.length;i++){
ps.setInt(1,Integer.parseInt(ids[i]));
ps.execute();
}
con.close();
%>
正在删除图书,3秒后自动跳转......
</body>
</html>
bookEdit.jsp 代码:
<%@ page language="java" contentType="text/html; charset=UTF-8"
where id=?");
ps.setInt(1,Integer.parseInt(strId));
ResultSet rs=ps.executeQuery(); if(rs.next()){ %> <form name="form1" method="post" action="bookSaveEdit.jsp"> <!-- 关键语句 --> <input type="hidden" name="id" value="<%=rs.getInt("id") %>"> <div align="center" class="STYLE1">编辑图书信息</div> <table width="300" height="120" border="1" align="center">
=
DriverManager.getConnection("jdbc:mysql://localhost:3306/bk","root","12345
6");
PreparedStatement ps = con.prepareStatement("delete from t_book where
id=?");
<tr>
<td width="74">书名:</td>
<td width="210"><input name="name" type="text" id="name"
value="<%=rs.getString("name") %>"></td>
</tr>
<tr>
<td>出版社:</td>
<td><input
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>编辑图书信息</title>
<style type="text/css">
<!--
.STYLE1 {
font-size: 36px;
<span class="STYLE1">登录图书管理系统</span> </caption> <tr>
<td width="166">用户名:</td> <td width="318"><input name="username" type="text" id="username"></td> </tr> <tr> <td>密码:</td> <td><input name="password" type="password" id="password"></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="Submit" value="登录"> <input type="reset" name="Submit2" value="取消"></td> </tr> </table> </form> </body> </html> Valid.jsp 代码: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.sql.*" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>判断登录</title>
<title>删除图书</title>
</head>
<body>
<%
//["3","4","6"]
String[] ids = request.getParameterValues("ids");
Class.forName("com.mysql.jdbc.Driver");
Connection
con
%>
</body>
</html>
BookAdd.jsp 代码:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
</head>
<body>
<%
String user=request.getParameter("username");
String pass=request.getParameter("password");
Class.forName("com.mysql.jdbc.Driver");
Connection
<tr>
<td colspan="2" align="center"><input type="submit" name="Submit"
value="确定添加">
<input type="reset" name="Submit2" value="重置"></td>
</tr>
</table>
</form>
con
=
DriverManager.getConnection("jdbc:mysql://localhost:3306/bk","root","12345
6");
Байду номын сангаас
PreparedStatement ps =con.prepareStatement("select * from t_account
where username=? and password=?");
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加图书信息</title>
<style type="text/css">
</body>
</html>
BookDel.jsp 代码:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
font-weight: bold;
}
-->
</style>
</head>
<body>
<%
String strId = request.getParameter("id");//获取传过来的参数(网络上
传输的只能是字符串)
Class.forName("com.mysql.jdbc.Driver");//java的反射
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="Submit"
<table width="300" height="120" border="1" align="center">
<tr> <td width="74">书名:</td> <td width="210"><input name="name" type="text" id="name"></td>
</tr> <tr>
pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
Connection
con
=
DriverManager.getConnection("jdbc:mysql://localhost:3306/bk","root","12345
6");
PreparedStatement ps =con.prepareStatement("select * from t_book
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="refresh" content="3;URL=bookList.jsp">
<td>出版社:</td>
<td><input name="publish" type="text" id="publish"></td> </tr> <tr>
<td>价格:</td>
<td><input name="price" type="text" id="price"></td>
</tr>
name="publish"
type="text"
id="publish"
value="<%=rs.getString("publish") %>"></td>
</tr>
<tr>
<td>价格:</td>
<td><input
name="price"
type="text"
id="price"
value="<%=rs.getInt("price") %>"></td>
Login.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>登录图书管理系统 </title> <style type="text/css"> <!-.STYLE1 {
<!--
.STYLE1 {
font-size: 36px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="bookSaveAdd.jsp">
<div align="center" class="STYLE1">添加图书信息 </div>
ps.setString(1,user);
ps.setString(2,pass);
ResultSet rs = ps.executeQuery();
if(rs.next()){response.sendRedirect("bookList.jsp");}
else response.sendRedirect("login.jsp");
相关文档
最新文档