<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage=""%> <%@ page import="com.dao.BookDAO"%> <%@ page import="com.dao.BookTypeDAO"%> <%@ page import="com.actionForm.BookForm"%> <%@ page import="com.actionForm.BookTypeForm"%> <%@ page import="com.dao.BookCaseDAO"%> <%@ page import="com.actionForm.BookCaseForm"%> <%@ page import="com.dao.PublishingDAO"%> <%@ page import="com.actionForm.PublishingForm"%> <%@ page import="java.util.*"%> <html> <% String str = null; BookTypeDAO bookTypeDAO = new BookTypeDAO(); Collection coll_type = (Collection) bookTypeDAO.query(str); if (coll_type == null || coll_type.isEmpty()) { out.println("<script>alert('请先录入图书类型信息!');history.back(-1);</script>"); } else { Iterator it_type = coll_type.iterator(); int typeID = 0; String typename = ""; BookCaseDAO bookcaseDAO = new BookCaseDAO(); String str1 = null; Collection coll_bookcase = (Collection) bookcaseDAO.query(str1); if (coll_bookcase == null || coll_bookcase.isEmpty()) { out.println("<script>alert('请先录入书架信息!');history.back(-1);</script>"); } else { Iterator it_bookcase = coll_bookcase.iterator(); int bookcaseID = 0; String bookcasename = ""; PublishingDAO pubDAO = new PublishingDAO(); String str2 = null; Collection coll_pub = (Collection) pubDAO.query(str2); if (coll_pub == null || coll_pub.isEmpty()) { out.println("<script>alert('请先录入出版社信息!');history.back(-1);</script>"); } else { Iterator it_pub = coll_pub.iterator(); String isbn = ""; String pubname = ""; %> <script language="jscript"> function check(form){ if(form.barcode.value==""){ alert("请输入条形码!");form.barcode.focus();return false; } if(form.bookName.value==""){ alert("请输入图书名称!");form.bookName.focus();return false; } if(form.price.value==""){ alert("请输入图书定价!");form.price.focus();return false; } } </script>
时间: 2023-06-25 10:05:36 浏览: 101
java学生课绩管理系统jsp+servlet+javaBean+sqlserver
5星 · 资源好评率100%
这段代码是一个 JSP 页面,用于添加图书信息。在页面中,首先通过 BookTypeDAO、BookCaseDAO 和 PublishingDAO 查询图书类型、书架和出版社信息。如果这些信息为空,会通过 JavaScript 弹窗提示用户先录入相关信息。如果这些信息都不为空,则会显示一个表单,让用户输入图书的条形码、名称、价格等信息,并通过 JavaScript 验证用户输入的合法性。在用户点击提交按钮后,会将表单数据传递给 BookDAO,通过 BookDAO 将图书信息插入到数据库中。
阅读全文