op_bookclass.java~4~
资源名称:bookshop.zip [点击查看]
上传用户:sxlinghang
上传日期:2022-07-20
资源大小:1405k
文件大小:3k
源码类别:
数据库编程
开发平台:
Java
- package bookshop.run;
- /**
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) 2004</p>
- * <p>Company: </p>
- * @author not attributable
- * @version 1.0
- */
- import java.util.*;
- import bookshop.util.*;
- import bookshop.book.*;
- import java.sql.*;
- import java.lang.String;
- import javax.servlet.http.HttpServletRequest;
- public class op_bookclass extends DataBase{
- public op_bookclass() {
- }
- private bookclass bookclass = new bookclass(); //新的图书分类
- private javax.servlet.http.HttpServletRequest request; //建立页面请求
- private Vector classlist; //图书类别向量数组
- public Vector getClasslist() {
- return classlist;
- }
- public String getBookClassSql() {
- sqlStr = "select id,classname from bookclass order by id";
- return sqlStr;
- }
- public boolean seachBookClass() throws Exception {
- int id = 0;
- String classname = "";
- int rscount = 0;
- try {
- DataBase db = new DataBase();
- db.connect();
- stmt = db.conn.createStatement ();
- rs = stmt.executeQuery(getBookClassSql());
- rscount = stmt.getMaxRows();
- classlist = new Vector(rscount+1);
- classlist.clear();
- while (rs.next()){
- id = rs.getInt("id");
- classname = rs.getString("classname");
- bookclass bc = new bookclass(id,classname);
- classlist.addElement(bc);
- }
- rs.close();
- return true;
- }
- catch (SQLException sqle){
- System.out.println(sqle);
- return false;
- }
- }
- public boolean getRequest(javax.servlet.http.HttpServletRequest newrequest) {
- boolean flag = false;
- try{
- request = newrequest;
- String bookclassname = request.getParameter("bookclassname");
- if (bookclassname==null || bookclassname.equals(""))
- {
- bookclassname = "";
- flag = false;
- }
- bookclass.setClassName(bookclassname);
- return true;
- }catch (Exception e){
- return false;
- }
- }
- };