JSP 9일차

9. 게시판-글몰록보기,글쓰기,글상세보기



C:\MySQL5.1\bin> mysql -u root -p mydb < zipcode.txt
password : 1234
형식) mysql -u 접속계정명 -p 접속DB명 < 불러올파일명

※ SQLGateforMySQL->그래픽툴

sqlgateformysql


● list.jsp(페이징처리)

게시판->num(게시물번호), pageNum(페이지번호)
mysql-connector-java-5.1.12-bin -> WEB-INF – lib에 넣기
writeForm.jsp(글쓰기)
1. 글쓰기 메서드(insertArticle())

insertarticle   insertarticle_1
1) 답변글
update board set re_step=re_step+1 where ref=? and re_step > ?
=>그룹번호가 같고 나보다 step값이 클놈을 찾아서 step값을 하나 증가시켜라
sql=”insert into board(wirter, emil,subject,passwd,reg_date,”;
sql+=”ref,re_step,re_level,content,ip)values(?,?,?,?,?,?,?,?,?,?)”;
num                    ref       step        level  
  |                           0           0              0
      -aaa                0           1               1
           | 
           -aaa-2       0          2               2     
         |
           -aaa-1       0          2->3         2
2) 신규글
sql=”insert into board(wirter, emil,subject,passwd,reg_date,”;
sql+=”ref,re_step,re_level,content,ip)values(?,?,?,?,?,?,?,?,?,?)”;

2. writeForm.jsp

writeform writeform_1

3. writePro.jsp이 필요

writepro

4. 글상세보기(getArticle())

getarticle

5. list.jsp(추가페이징처리) -> content.jsp -> writeForm.jsp(댓글연결)

list.jsp

list   list_1

content.jsp

content   content_1

실행결과

list_result content_result

writeform_result list_result_reply