首页 > Web开发 > 详细

jsp图书管理

时间:2021-05-15 12:31:08      阅读:16      评论:0      收藏:0      [点我收藏+]
package com.library.dao;

import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.sun.corba.se.pept.transport.Connection;
import com.sun.corba.se.spi.orbutil.fsm.Guard.Result;

public class BaseDao {

    
    
    //gain
    
    
    
    protected Connection getConnection() {
        Connection conn = null;
        
        
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conn = (Connection) DriverManager.getConnection("jdbc:mysq;://localhost:3306/mysql","root","1234");
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        }
        return conn;
        
    }
    
    //release
    
    
    @SuppressWarnings("unused")
    private void closeAll(Connection con,PreparedStatement ps,ResultSet rs) {
        // TODO Auto-generated method stub
        try {
            if (rs != null) {
                rs.close();
            }
            if (ps != null) {
                ps.close();
            }
            if (con != null) {
                con.close();
            }
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        }
    }
}
insert into book (b_name,b_author,b_time,b_type) values (‘CSS‘,‘Alice‘,2020-02-04,0);
insert into book (b_name,b_author,b_time,b_type) values (‘JSP‘,‘Alice‘,2020-02-04,0);
insert into book (b_name,b_author,b_time,b_type) values (‘JavaScript‘,‘Alice‘,2020-02-04,0);
insert into book (b_name,b_author,b_time,b_type) values (‘C#‘,‘Jack‘,2020-02-04,0);
public class BookManage {
    private int id;
    private String name;
    private String author;
    private String time;
    private int type;
    public BookManage() {
        
    }
    
    public BookManage(String name,String author,String time,int type) {
        this.name = name;
        this.author = author;
        this.time = time ;
        this.type = type;
    }
    
    public BookManage(int id,String name,String author,String time,int type) {
        this.id = id;
        this.name = name;
        this.author = author;
        this.time = time ;
        this.type = type;
    }
    
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAuthor() {
        return author;
    }
    public void setAuthor(String author) {
        this.author = author;
    }
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
    public int getType() {
        return type;
    }
    public void setType(int type) {
        this.type = type;
    }
}

 

jsp图书管理

原文:https://www.cnblogs.com/lutiantian/p/14770944.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!