⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addbooks.jsp

📁 面向对象软件工程案例
💻 JSP
字号:
<!--   ***********************************************************
       **项目名称:网上书店管理端             ************************
       **内容:增加图书服务处理               ************************
       **此页作者:luic                       ************************
       **完成日期:2004/4/25                  ************************
       **修改:                               ************************
       **                                     ************************
       ***************************************************************
-->

<%@ page contentType="text/html;charset=GB2312"
%>
<%@ page import="java.sql.*" %>
<%
	String bookName=request.getParameter("bookName");
	//out.println(bookName);
	String bookID=request.getParameter("bookID");
	//out.println(bookID);
	String publisher=request.getParameter("publisher");
	//out.println(publisher);
	String pubdate=request.getParameter("pubdate");
	//out.println(pubdate);
	String bookAuthor=request.getParameter("bookAuthor");
	//out.println(bookAuthor);
	String edition=request.getParameter("edition");
	//out.println(edition);
	String bookSort=request.getParameter("bookSort");
	//out.println(bookSort);
	String stockNum=request.getParameter("stockNum");
	//out.println(stockNum);
	String bookPrice=request.getParameter("bookPrice");
	double bookPrice1=Double.parseDouble(bookPrice);
	//out.println(bookPrice);
	String contentIntroduction=request.getParameter("contentIntroduction");
	//out.println(contentIntroduction);
	if(bookName==null||bookID==null||publisher==null||pubdate==null||bookAuthor==null||edition==null||bookSort==null||stockNum==null||bookPrice==null||contentIntroduction==null){
%>
<script>
	alert("你填写的信息不完全!");
</script>
<%
	}
	else{
	       try{
	        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        	Connection con=DriverManager.getConnection("jdbc:odbc:bookStore");
        	Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
        	//String str1="'"+bookName+"'";
		    //String str2="'"+publisher+"'";
		    //String str3="'"+pubdate+"'";
		    //String str4="'"+bookAuthor+"'";
		    //String str5="'"+edition+"'";
		    //String str6="'"+bookSort+"'";
		    //String str7="'"+stockNum+"'";
		    //String str8="'"+bookPrice1+"'";
		    //String str9="'"+contentIntroduction+"'";
		    //String str10="'"+bookID+"'";
		    String strins=new String();
//		    strins="insert into book(bookID,bookName,publisher,pubDate,bookAuthor,bookPrice,bookSort,stockNum,contentIntroduction,edition) values("+str10+","+str1+","+str2+","+str3+","+str4+","+str6+","+str7+","+str8+","+str9+","+str5+")";
		    strins="insert into book(bookID,bookName,publisher,pubDate,bookAuthor,bookPrice,bookSort,stockNum,contentIntroduction,edition) values('";
		    strins=strins+bookID+"','";
		    strins=strins+bookName+"','";
		    strins=strins+publisher+"','";
		    strins=strins+pubdate+"','";
		    strins=strins+bookAuthor+"','";
		    strins=strins+bookPrice1+"','";
		    strins=strins+bookSort+"','";
		    strins=strins+stockNum+"','";
		    strins=strins+contentIntroduction+"','";
		    strins=strins+edition+"')";
		    //out.println(strins);
		    stmt.executeUpdate(strins);	
		    out.println("成功添加"+bookName+"图书");	   
		    stmt.close();
	        con.close();
	        }
	         catch(Exception e){
		      out.println(e.toString());
		    }
		    }
%>
<html>
<head>
    <title>增加图书服务页</title>
</head>
<script>
     var sec=3;
     function countDown(){
       if(sec>0){
          num.innerHTML=sec--;
         }
       else
         location="addBook.htm";
      }
</script>
<body onLoad="setInterval('countDown()',1000)">
3秒钟自动返回.......
<font id="num" size=4 face="impact">3</font>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -