jsp beans 로 게시판 만들기
디비에 테이블 생성
create table board(
unq int unsigned not null auto_increment,
title varchar(100) not null,
pwd varchar(100) not null,
name varchar(50),
content text,
hit int unsigned default '0',
rdate datetime,
primary key(unq));
================================================================
DBCon.java
---------------------------------------------------------------
package testBean;
import java.sql.*;
import java.sql.DriverManager;
public class DBCon {
Connection con = null;
String url = "jdbc:mysql://localhost:3306/mysql";
public Connection getConnection() {
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(url, "root", "apmsetup");
return con;
} catch (Exception e) {
return null;
}
}
}
================================================================
ElementBoard.java
----------------------------------------------------------------
package testBean;
public class ElementBoard {
private String title;
private String pwd;
private String name;
private String content;
private String rdate;
private int unq;
private int hit;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getRdate() {
return rdate;
}
public void setRdate(String rdate) {
this.rdate = rdate;
}
public int getUnq() {
return unq;
}
public void setUnq(int unq) {
this.unq = unq;
}
public int getHit() {
return hit;
}
public void setHit(int hit) {
this.hit = hit;
}
}
'개발 > jsp' 카테고리의 다른 글
jstl 변수 선언 (0) | 2015.10.08 |
---|---|
jsp URLEncoder (0) | 2015.10.06 |
jsp 달력만들기 (0) | 2015.09.25 |
jsp URLEncoder (0) | 2015.09.25 |
jsp request 메소드 사용 (0) | 2015.09.24 |
댓글