JSP图书管理系统【完整代码】

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

Login.jsp代码:%@pagelanguage=javacontentType=text/html;charset=UTF-8pageEncoding=UTF-8%!DOCTYPEhtmlPUBLIC-//W3C//DTDHTML4.01Transitional//EN=Content-Typecontent=text/html;charset=UTF-8title登录图书管理系统/titlestyletype=text/css!--.STYLE1{font-size:36px;font-weight:bold;}--/style/headbodyformname=form1method=postaction=valid.jsptablewidth=400height=120border=1align=centercaptionspanclass=STYLE1登录图书管理系统/span/captiontrtdwidth=166用户名:/tdtdwidth=318inputname=usernametype=textid=username/td/trtrtd密码:/tdtdinputname=passwordtype=passwordid=password/td/trtrtdcolspan=2align=centerinputtype=submitname=Submitvalue=登录inputtype=resetname=Submit2value=取消/td/tr/table/form/body/htmlValid.jsp代码:%@pagelanguage=javacontentType=text/html;charset=UTF-8pageEncoding=UTF-8%%@pageimport=java.sql.*%!DOCTYPEhtmlPUBLIC-//W3C//DTDHTML4.01Transitional//EN=Content-Typecontent=text/html;charset=UTF-8title判断登录/title/headbody%Stringuser=request.getParameter(username);Stringpass=request.getParameter(password);Class.forName(com.mysql.jdbc.Driver);Connectioncon=DriverManager.getConnection(jdbc:mysql://localhost:3306/bk,root,123456);PreparedStatementps=con.prepareStatement(select*fromt_accountwhereusername=?andpassword=?);ps.setString(1,user);ps.setString(2,pass);ResultSetrs=ps.executeQuery();if(rs.next()){response.sendRedirect(bookList.jsp);}elseresponse.sendRedirect(login.jsp);%/body/htmlBookAdd.jsp代码:%@pagelanguage=javacontentType=text/html;charset=UTF-8pageEncoding=UTF-8%!DOCTYPEhtmlPUBLIC-//W3C//DTDHTML4.01Transitional//EN=Content-Typecontent=text/html;charset=UTF-8title添加图书信息/titlestyletype=text/css!--.STYLE1{font-size:36px;font-weight:bold;}--/style/headbodyformname=form1method=postaction=bookSaveAdd.jspdivalign=centerclass=STYLE1添加图书信息/divtablewidth=300height=120border=1align=centertrtdwidth=74书名:/tdtdwidth=210inputname=nametype=textid=name/td/trtrtd出版社:/tdtdinputname=publishtype=textid=publish/td/trtrtd价格:/tdtdinputname=pricetype=textid=price/td/trtrtdcolspan=2align=centerinputtype=submitname=Submitvalue=确定添加inputtype=resetname=Submit2value=重置/td/tr/table/form/body/htmlBookDel.jsp代码:%@pagelanguage=javacontentType=text/html;charset=UTF-8pageEncoding=UTF-8%%@pageimport=java.sql.*%!DOCTYPEhtmlPUBLIC-//W3C//DTDHTML4.01Transitional//EN=Content-Typecontent=text/html;charset=UTF-8metahttp-equiv=refreshcontent=3;URL=bookList.jsptitle删除图书/title/headbody%//[3,4,6]String[]ids=request.getParameterValues(ids);Class.forName(com.mysql.jdbc.Driver);Connectioncon=DriverManager.getConnection(jdbc:mysql://localhost:3306/bk,root,123456);PreparedStatementps=con.prepareStatement(deletefromt_bookwhereid=?);for(inti=0;iids.length;i++){ps.setInt(1,Integer.parseInt(ids[i]));ps.execute();}con.close();%正在删除图书,3秒后自动跳转....../body/htmlbookEdit.jsp代码:%@pagelanguage=javacontentType=text/html;charset=UTF-8pageEncoding=UTF-8%%@pageimport=java.sql.*%!DOCTYPEhtmlPUBLIC-//W3C//DTDHTML4.01Transitional//EN=Content-Typecontent=text/html;charset=UTF-8title编辑图书信息/titlestyletype=text/css!--.STYLE1{font-size:36px;font-weight:bold;}--/style/headbody%StringstrId=request.getParameter(id);//获取传过来的参数(网络上传输的只能是字符串)Class.forName(com.mysql.jdbc.Driver);//java的反射Connectioncon=DriverManager.getConnection(jdbc:mysql://localhost:3306/bk,root,123456);PreparedStatementps=con.prepareStatement(select*fromt_bookwhereid=?);ps.setInt(1,Integer.parseInt(strId));ResultSetrs=ps.executeQuery();if(rs.next()){%formname=form1method=postaction=bookSaveEdit.jsp!--关键语句--inputtype=hiddenname=idvalue=%=rs.getInt(id)%divalign=centerclass=STYLE1编辑图书信息/divtablewidth=300height=120border=1align=centertrtdwidth=74书名:/tdtdwidth=210inputname=nametype=textid=namevalue=%=rs.getString(name)%/td/trtrtd出版社:/tdtdinputname=publishtype=textid=publishvalue=%=rs.getString(publish)%/td/trtrtd价格:/tdtdinputname=pricetype=textid=pricevalue=%=rs.getInt(price)%/td/trtrtdcolspan=2align=centerinputtype=submitname=Submitvalue=确定修改inputtype=resetname=Submit2value=取消/td/tr/table/form%}con.close();%/body/htmlbookList.jsp代码:%@pagelanguage=javacontentType=text/html;charset=UTF-8pageEncoding=UTF-8%%@pageimport=java.sql.*%!DOCTYPEhtmlPUBLIC-//W3C//DTDHTML4.01Transitional//EN=Content-Typecontent=text/html;charset=UTF-8title编辑图书信息/titlestyletype=text/css!--.STYLE1{font-size:36px;font-weight:bold;}--/style/headbody%StringstrId=request.getParameter(i

1 / 7
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功