240102 HTML detail.jsp

2024. 1. 3. 19:562023.11.21-2024.05.31

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<%@page import="java.util.Map"%>
<%@page import="com.sukgi.dao.BoardDAO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>톺아보기</title>
</head>
<body>
    <h1>톺아보기</h1>
    <%
    //http://localhost:8080/dec29web/detail.jsp?no=6&t=100&sub=&test=101
    //https://www.clien.net/service/board/news/18499574?od=T31&po=0&category=0
    String no = request.getParameter("no");//"3"
 
    //DAO에게  시키기기
    BoardDAO dao = new BoardDAO();
    Map<String, Object> detail = dao.detail(no);
    %>
    <!-- 삭제 이미지를 누르면 삭제되는 기능을 넣겠습니다.  -->
    <!--<a href="./delete.jsp?no="> <img alt="delete" src="./img/delete1.png"
        title="버튼을 누르면 삭제합니다.">
    </a? --!>
 
    <!-- 삭제 이미지를 누르면 삭제되는 기능을 넣겠습니다.  -->
 
    <img onclick="update(<%=detail.get("board_no")%>)" alt="수정"
        src="./img/update.png" title="버튼을 누르면 글을 수정합니다.">
    <img onclick="del(<%=detail.get("board_no")%>)" alt="삭제"
        src="./img/delete1.png" title="버튼을 누르면 삭제합니다.">
 
 
 
    <br> 제목 :    <%=detail.get("board_title")%>
    <br> 글쓴이 : <%=detail.get("board_write")%>
    <br> 날짜 :    <%=detail.get("board_date")%>
    <br> 번호 :    <%=detail.get("board_no")%>
    <br> 조회 : <%=detail.get("board_count")%>
    <br>
    <hr>
    <%=detail.get("board_content")%><br>
    <!-- 
     html 문서에서 간혹 onclick, On* = 자바스크립트
      -->
 
    <button onclick="location.href='./index.jsp'">돌아가기</button>
    <!-- 메소드 "what()" 로 작성 -->
 
    <button onclick="what()">눌러보세요</button>
 
    <script type="text/javascript">
    function update(){//함수
        var check = confirm("수정하시겠습니까?");
        if(check){
            alert("글을 수정합니다.")    
            location.href="./update?no=<%=detail.get("board_no")%>";
            //위 문장은 서버단에서-----------------------------여기부터 계산해 숫자로 되돌려 줍니다.
            //그 후 html/css/js단에서 처리합니다.
            
            //실행순서.
            //1. 자바코드들 먼저 실행 = 서버 단에서 처리
            //2. html/css/js/ 실행 = 클라이언트 단에서 처리
        }
    }
    </script>
 
    <script type="text/javascript">
    function what(){//함수
        for(var i =0; i<10; i++){
            alert("메롱");
        }
    }
    
    function del(no){
        if(confirm("정말 삭제할거야?")){
            location.href="./delete?no="+no;
            //.jsp -> 서블릿으로 변경
        
        }    
    }
    </script>
<!--  프레임워크/라이브러리 
C write
R list, detail
U update 
D delete(where 꼭 와야한다)
 
 + 페이징, 로그인, 세션
 + 값 검사
 + 파일 업로드-->
</html>
cs

'2023.11.21-2024.05.31' 카테고리의 다른 글

240102 HTML write.jsp  (0) 2024.01.03
240102 HTML update.jsp  (0) 2024.01.03
240102 HTML delete.jsp  (1) 2024.01.03
240102 HTML index.jsp  (0) 2024.01.03
240103 JAVA IO(OutputStream,InputStream)  (1) 2024.01.03