jsp图书管理

2021/5/15 10:55:13

本文主要是介绍jsp图书管理,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

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图书管理的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程