'Front-End/Bootstrap'에 해당되는 글 9건

  1. 2019.10.10 기본 홈페이지 디자인
  2. 2019.10.08 게시판 상세보기 페이지, 댓글 목록 페이지 꾸며보기 (내 프로젝트에 적용)
  3. 2019.10.07 게시판페이지 꾸며보기 (내 프로젝트에 적용)
  4. 2019.10.04 메인페이지 꾸며보기 (내 프로젝트에 적용)
  5. 2019.10.02 전체적으로 bootstrap 적용 (일부)
  6. 2019.10.02 로그인 폼에 bootstrap 적용
  7. 2019.10.02 메뉴바에 Bootstrap 적용
  8. 2019.09.27 Bootstrap 다운 및 스프링 프로젝트에 적용

기본 홈페이지 디자인

Front-End/Bootstrap 2019. 10. 10. 16:31

일단 만든 기능들은 전부다 기본적인 디자인으로라도 넣어봄. (Bootstrap - css 사용)



:

게시판 상세보기 페이지, 댓글 목록 페이지 꾸며보기 (내 프로젝트에 적용)

Front-End/Bootstrap 2019. 10. 8. 17:15

어제와 마찬가지로 검색기능, 게시글 상세보기 페이지 및 댓글 목록 페이지에 부트스트랩(css) 적용해서 디자인 수정해보기.



검색기능


memberboard.jsp 중 일부


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
<form name="form1" method="post" action="list.do">
<div class = "search row" style = "margin:auto;">
    <div class = "col-xs-2 col-sm-2" style = "margin:auto;">
    <select name="search_option" class = "form-control" align = "center">
        <option value="user_id"
<c:if test="${map.search_option == 'user_id'}">selected</c:if>
        >작성자</option>
        <option value="title" 
<c:if test="${map.search_option == 'title'}">selected</c:if>
        >제목</option>
        <option value="content" 
<c:if test="${map.search_option == 'content'}">selected</c:if>
        >내용</option>
        <option value="all" 
<c:if test="${map.search_option == 'all'}">selected</c:if>
        >작성자+내용+제목</option>
    </select>
 </div>   
 
 
<div class = "col-xs-2 col-sm-2" style = "margin:auto;">
    <div class = "input-group" style = "margin:auto;">
    <input type = "text" name="keyword" value="${map.keyword}" class = "form-control" style="width:300px;" align = "center">  </div>  </div>
    <input type = "submit" value="조회" class = "btn btn-default" align = "center"
    <button type = "button" id = "btnWrite" align = "center" class = "btn btn-default">글쓰기</button>
    
</div>
</div>
</center
   
</form>
cs









나머지 상세보기 페이지 및 댓글 관련 페이지



memberboardview.jsp (게시글 상세보기 페이지)


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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<%@ include file="../include/header.jsp" %>
<%@ include file="../include/menu.jsp" %>
<script src="${path}/include/js/common.js"></script>
<script src="${path}/ckeditor/ckeditor.js"></script>
 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
 
<link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
 
 <style>
    #contentForm {
      width: 40%;
      margin: 0 auto;
      padding-top: 12%;
    }
 
    .table > thead > tr > th, .table > tbody > tr > th {
      background-color: #e6ecff;
      text-align: center;
    }
  </style>
 
 
<script>
$(function(){
    
    //목록 버튼
    $("#btnList").click(function(){
        location.href="list.do";
    });
 
 
    //수정 버튼
    $("#btnUpdate").click(function(){
    if(confirm("수정하시겠습니까?")){
    document.form1.action="update.do";
    document.form1.submit();
            }
        });
 
 
    //댓글쓰기 버튼 (버튼을 눌러서 id값이 넘어와서 실행되는 자바스크립트 구문)
    listReply();
 
        
    $("#btnReply").click(function(){
        if(confirm("댓글을 작성하시겠습니까?")){
    var r_content = $("#r_content").val();    //댓글의 내용
    var member_bno =  "${dto.member_bno}";
    var params = {"r_content" : r_content, "member_bno" : member_bno};
    
    
    $.ajax({
        type: "post"//데이터를 보낼 방식
        url: "reply_insert.do"//데이터를 보낼 url
        data: params, //보낼 데이터
    
        
        complete : function(data){//데이터를 보내는 것이 성공했을 시 출력되는 메시지
            alert("댓글이 등록되었습니다.");
            listReply2();
                }
            });
        }
        
    });
    
    
//댓글 목록을 출력하는 함수
function listReply(){
    $.ajax({
        type: "get",    //get방식으로 자료를 전달
        url: "reply_list.do?member_bno=${dto.member_bno}&curPage=${curPage}&search_option=${search_option}&keyword=${keyword}",    //컨트롤러에 있는 list.do로 맵핑되고 게시글 번호도 같이 보낸다.
        success: function(result){    //자료를 보내는것이 성공했을때 출력되는 메시지
            
            //댓글목록을 실행한 결과를 가져온다.
        $("#listReply").html(result);
            }
        });
}
 
 
function listReply2(){
    $.ajax({
        type: "get",
        contentType: "application/json",
        url: "reply_list_json.do?member_bno=${dto.member_bno}",
        success: function(result){
            console.log(result);
            var output="<table>";
            for(var i in result){
                var repl=result[i].replytext;
                repl = repl.replace(/  /gi,"&nbsp;&nbsp;");//공백처리
                repl = repl.replace(/</gi,"&lt;"); //태그문자 처리
                repl = repl.replace(/>/gi,"&gt;");
                repl = repl.replace(/\n/gi,"<br>"); //줄바꿈 처리
                
                output += "<tr><td>"+result[i].name;
                date = changeDate(result[i].regdate);
                output += "("+date+")";
                output += "<br>"+repl+"</td></tr>";
            }
            output+="</table>";
            $("#listReply").html(output);
        }
    });
}
 
 
//삭제 버튼
$("#btnDelete").click(function(){
    if(confirm("삭제하시겠습니까?")){
        document.form1.action="delete.do";
        document.form1.submit();
        }
    });
    
    
//추천하기 버튼
$("#btnRecommend").click(function(){
    if(confirm("해당 글을 추천하시겠습니까?")){
        document.form1.action="recommend.do";
        document.form1.submit();
        
        alert("해당 글을 추천하였습니다.")
        
        }
    
    });
 
});
 
 
</script>
 
<h2>게시물 보기 </h2> 조회수 : ${dto.viewcnt}
<!-- 게시물을 작성하기 위해 컨트롤러의 insert.do로 맵핑 -->
<form id="form1" name="form1" method="post" action="${path}/board/insert.do">
<div class="input-group input-group-sm" role="group" style = "text-align:left">
<table class="table table-striped table-bordered">
<tread>
<tr>
<td><input type = "hidden" id = "member_bno" name = "member_bno" class="form-control" aria-describedby="basic-addon1" value = "${dto.member_bno }" class="form-control" aria-describedby="basic-addon1" >글번호 : ${dto.member_bno }</td>
</tr>
 
 
<tr>
<td><input name="title" id="title" size="80"
                    value="${dto.title}"
                    placeholder="제목을 입력하세요" class="form-control" aria-describedby="basic-addon1" ></td></tr>
                    
<br><br>
                              
<!-- placeholder은 제목을 입력할 수 있도록 도움말을 출력함 -->
<tr>
<div style="width:800px;">
<td><textarea class="form-control" id="content" name="content" rows="3" cols="80" 
placeholder="내용을 입력하세요">${dto.content}</textarea></td>
</div>
</tr>
</tread>
</table>
 
</div>
</div>
 
</form>
 
 
 
<!-- 마찬가지로 내용을 입력하도록 도움말을 출력함 -->
<script>
// ckeditor 적용
//id가 content인 태그 (글의 내용을 입력하는 태그)를 ck에디터를 적용한다는 의미
CKEDITOR.replace("content",{
    height: "300px"
});
 
CKEDITOR.replace("r_content",{
    height: "300px"
});
</script>
 
<div style = "width:700px; text-align:center;">
<!-- 수정, 삭제에 필요한 글번호를 hidden 태그에 저장한다. -->
    <input type = "hidden" name = "member_bno" value = "${dto.member_bno }">
    
    <!-- 본인만 수정, 삭제 버튼을 표시한다. -->
    <c:if test = "${sessionScope.user_id == dto.user_id or sessionScope.navername == dto.user_id or sessionScope.kakaonickname == dto.user_id or sessionScope.facebookname == dto.user_id}">
            <div class="btn-group btn-group-sm" role="group" aria-label="...">
            <div style = "text-align:center;" >
            
            <button type = "submit" id = "btnUpdate" class="btn btn-default">수정</button>
            <button type = "button" id = "btnDelete" class="btn btn-default">삭제</button>
            
            </div></div>
    </c:if>
    
    
    <!-- 관리자에게는 삭제 버튼을 표시한다. -->
    <c:if test = "${sessionScope.admin_id != null}">
    
    <div class="btn-group btn-group-sm" role="group" aria-label="...">
    <div style = "text-align:center;" >
            <button type = "button" id = "btnDelete" class="btn btn-default">삭제</button>
            </div></div>
    </c:if>
    
    
    <!-- 로그인이 되어있고, 본인 글이 아닐경우에만 추천할 수 있도록 버튼을 출력 -->
    <c:if test = "${sessionScope.user_id != null and sessionScope.user_id != dto.user_id
    or sessionScope.navername != null and sessionScope.navername != dto.user_id
    or sessionScope.kakaonickname != null and sessionScope.kakaonickname != dto.user_id
    or sessionScope.facebookname != null and sessionScope.facebookname != dto.user_id}">
    <div class="btn-group btn-group-sm" role="group" aria-label="...">
    <div style = "text-align:center;" >
    
            <button type = "button" id = "btnRecommend" class="btn btn-default" >추천하기</button>
            </div></div>
    
    </c:if>
    
    <!-- 관리자에게도 추천 버튼 출력 -->
    <!-- 관리자에게는 삭제 버튼을 표시한다. -->
    <c:if test = "${sessionScope.admin_id != null}">
    
    <div class="btn-group btn-group-sm" role="group" aria-label="...">
    <div style = "text-align:center;" >
            <button type = "button" id = "btnRecommend" class="btn btn-default" >추천하기</button>
            
            </div></div>
    </c:if>
    
    
    <!-- 글목록은 본인이 아니어도 확인 가능하게 한다. -->
        <div class="btn-group btn-group-sm" role="group" aria-label="...">
    <div style = "text-align:center;" >
    
    <button type = "button" id = "btnList" class="btn btn-default">목록</button>
    </div></div>
    
    <!-- 로그인이 되어있는 상태에서만 댓글 작성 버튼이 출력되도록 한다. -->
    
    <c:if test = "${sessionScope.user_id != null or sessionScope.navername != null 
    or sessionScope.kakaonickname != null or sessionScope.facebookname != null}">
    <br><br><br>
    <div class="btn-group btn-group-sm" role="group" aria-label="...">
    <div style = "text-align:center;" >
    <textarea rows = "5" cols = "80" id = "r_content" name = "r_content" class="form-control" aria-describedby="basic-addon1" placeholder="댓글을 입력하세요."></textarea>
    </div></div>
    <br>
    
    
    <!-- 댓글쓰기 버튼을 클릭하면 위쪽에 있는 자바스크립트 구문이 실행되어서 컨트롤러로 맵핑됨 --><br><br>
    <div class="btn-group btn-group-sm" role="group" aria-label="...">
    <div style = "text-align:center;" >
    
    <button type = "button" id = "btnReply" class="btn btn-default" >댓글쓰기</button>
    </div></div>
    </c:if>
    
    <!-- 댓글 목록 -->
    <!-- 댓글이 등록이 되면 listReply에 댓글이 쌓이게 된다. -->
    <div id = "listReply"></div>
    
<body>
</body>
</html>
cs




memberboardreply_list.jsp (게시글 관련 댓글 페이지)


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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<%@ include file="../include/header.jsp"%>
 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
 
<link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
 
 
<style>
#contentForm {
    width: 40%;
    margin: 0 auto;
    padding-top: 12%;
}
.table>thead>tr>th, .table>tbody>tr>th {
    background-color: #e6ecff;
    text-align: center;
}
</style>
 
 
<script>
    $(function() {
 
        //댓글 수정 버튼
        $("#btn_reply_Update").click(
                function() {
                    if (confirm("수정 하시겠습니까?")) {
 
                        //수정하는데 필요한 정보들, 댓글 번호, 글 내용, 작성자 아이디, 게시글 번호를 변수에 저장한다.
                        var rno = $("#rno").val();
                        var r_content = $("textarea#r_content").text();
                        var user_id = $("#user_id").val();
                        var member_bno = $("#member_bno").val();
 
                        //게시글 세부 페이지로 포워딩을 하기위해 페이지 관련 값들을 변수에 저장해서 컨트롤러로 보낸다.
                        var curPage = $("#curPage").val();
                        var search_option = $("#search_option").val();
                        var keyword = $("#keyword").val();
 
                        //페이지 관련 값들과 댓글 수정에 필요한 값들을 url로 전송한다.
                        document.form1.action = "reply_update.do?rno=" + rno
                                + "&r_content=" + encodeURI(r_content)
                                + "&user_id=" + user_id + "&member_bno="
                                + member_bno + "&curPage=" + curPage
                                + "&search_option=" + search_option
                                + "&keyword=" + keyword;
                        document.form1.submit();
 
                        alert("댓글이 수정되었습니다.")
                    }
                });
 
        //댓글 삭제 버튼
        $("#btn_reply_Delete").click(
                function() {
 
                    if (confirm("삭제 하시겠습니까?")) {
 
                        //댓글 삭제를 하기위해 댓글 번호, 글 번호, 댓글 내용, 그리고 게시글 세부 페이지로 포워딩 하기 위해 페이지 관련 값들을 변수에 저장한다.
                        var rno = $("#rno").val();
                        var member_bno = $("#member_bno").val();
                        var content = $("textarea#r_content").text();
                        var curPage = $("#curPage").val();
                        var search_option = $("#search_option").val();
                        var keyword = $("#keyword").val();
 
                        //url로 삭제에 필요한 변수들을 보낸다.
                        document.form1.action = "reply_delete.do?rno=" + rno
                                + "&member_bno=" + member_bno + "&curPage="
                                + curPage + "&search_option=" + search_option
                                + "&keyword=" + keyword;
 
                        document.form1.submit();
 
                        alert("댓글이 삭제되었습니다.")
 
                    }
                });
    });
</script>
 
 
 
<body>
    <!-- 배열이 비어있지 않으면 참을 출력함. (다시말해서 배열에 값들이 있으면 댓글 리스트를 출력한다.) -->
 
 
 
    <c:if test="${not empty map.list}">
        <h2>댓글 리스트</h2>
        <div class="input-group input-group-sm" role="group"
            style="text-align: left">
            <table class="table table-striped table-bordered" border="1"
                width="800px" align="left">
 
 
                <c:forEach var="row" items="${map.list}">
 
                    <tr>
                        <td><br></td>
                    </tr>
 
                    <tr>
                        <td>닉네임 : ${row.user_id}</td>
                    </tr>
 
                    <tr>
                        <td>작성일자 : ${row.reg_date} 댓글번호 : ${row.rno }</td>
                    </tr>
 
                    <tr>
                        <td>댓글 내용 : ${row.r_content}</td>
                    </tr>
 
 
                    <!-- 폼태그 안에 위쪽에 있는 자바스크립트 구문에 필요한 값들을 노출시키지 않게 하기 위해 hidden타입으로 값들을 전달한다. -->
                    <form method="POST" id="form1">
 
                        <input type="hidden" id="rno" name="rno" value="${row.rno}">
                        <input type="hidden" id="user_id" name="user_id"
                            value="${row.user_id}"> <input type="hidden"
                            id="member_bno" name="member_bno" value="${row.member_bno}">
                        <input type="hidden" id="curPage" name="curPage"
                            value="${curPage}"> <input type="hidden"
                            id="search_option" name="search_option" value="${search_option}">
                        <input type="hidden" id="keyword" name="keyword"
                            value="${keyword}">
 
                        <tr>
                            <td>
                                <div style="width: 800px;">
                                    <textarea class="form-control" placeholder="수정할 내용을 입력하세요"
                                        id="r_content" name="r_content" rows="4" cols="80"></textarea>
                                </div>
                                <br>
                            <br>
                            </td>
                        </tr>
                    </form>
 
 
 
 
 
 
                    <!-- 본인일 경우에만 댓글 수정버튼과 댓글 삭제 버튼이 출력되도록 설정함 -->
 
                    <div style="width: 700px; text-align: right;">
 
                        <c:if
                            test="${sessionScope.user_id == row.user_id or sessionScope.navername == row.user_id or sessionScope.kakaonickname == row.user_id or sessionScope.facebookname == row.user_id}">
 
                            <tr>
                                <td>
                                    <div class="btn-group btn-group-sm" role="group"
                                        aria-label="...">
                                        <div style="text-align: center;">
                                            <button type="button" id="btn_reply_Update"
                                                class="btn btn-default">댓글 수정</button>
                                            <button type="button" id="btn_reply_Delete"
                                                class="btn btn-default">댓글 삭제</button>
                                        </div>
                                    </div>
                                </td>
                            </tr>
 
 
 
                        </c:if>
 
                        <!-- 관리자아이디로 로그인했을 경우에 삭제버튼을 출력 -->
                        <c:if test="${sessionScope.admin_id != null}">
 
                            <tr>
                                <td>
                                    <div class="btn-group btn-group-sm" role="group"
                                        aria-label="...">
                                        <div style="text-align: center;">
                                            <button type="button" id="btn_reply_Delete"
                                                class="btn btn-default">댓글 삭제</button>
                                        </div>
                                    </div>
                                </td>
                            </tr>
 
                        </c:if>
                    </div>
                    <br>
                    <br>
                    </td>
                    </tr>
 
                </c:forEach>
            </table>
    </c:if>
 
 
</body>
</html>
cs









:

게시판페이지 꾸며보기 (내 프로젝트에 적용)

Front-End/Bootstrap 2019. 10. 7. 16:21

회원게시판, 공지사항 게시판 목록 및 게시판 상세보기 및 게시글 쓰기 페이지에 css 적용해보기.




adminboard.jsp 중 일부 (공지사항 게시글 목록)


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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<%@ include file="../include/header.jsp"%>
<%@ include file="../include/menu.jsp"%>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
 
<!-- 게시판에 디자인을 추가하도록 하는 코드 -->
<link rel = "stylesheet" href = "/css/bootstrap.css">
 
<style>
    #container {
      width: 70%;
      margin: 0 auto;     /* 가로로 중앙에 배치 */
      padding-top: 10%;   /* 테두리와 내용 사이의 패딩 여백 */
    }
     
    #list {
      text-align: center;
    }
   
    #write {
      text-align: right;
    }
     
    /* Bootstrap 수정 */
    .table > thead {
      background-color: #b3c6ff;
    }
    .table > thead > tr > th {
      text-align: center;
    }
    .table-hover > tbody > tr:hover {
      background-color: #e6ecff;
    }
    .table > tbody > tr > td {
      text-align: center;
    }
    .table > tbody > tr > #title {
      text-align: left;
    }
     
    div > #paging {
      text-align: center;
    }
     
    .hit {
      animation-name: blink;
      animation-duration: 1.5s;
      animation-timing-function: ease;
      animation-iteration-count: infinite;
      /* 위 속성들을 한 줄로 표기하기 */
      /* -webkit-animation: blink 1.5s ease infinite; */
    }
     
    /* 애니메이션 지점 설정하기 */
    /* 익스플로러 10 이상, 최신 모던 브라우저에서 지원 */
    @keyframes blink {
      from {color: white;}
      30% {color: yellow;}
      to {color: red; font-weight: bold;}
      /* 0% {color:white;}
      30% {color: yellow;}
      100% {color:red; font-weight: bold;} */
    }
  </style>
 
 
 
 
<script>
 
 
//게시판 목록 페이지로 이동하게 하는 함수
function list(page){
    console.log("페이지를 이동합니다.");
    location.href="admin_board_list.do?curPage="+page;
};
 
//글쓰기 폼으로 이동하게 하는 함수
$(function(){    
        $("#btnWrite").click(function(){
            location.href="admin_board_write.do";
        });
});
 
</script>
 
 
 
<%@ include file="../include/login.jsp"%><br>
    
 
 
<center>
<div id = "list">
<d>공지사항 게시판</d>
</div>
 
 
<div>
<table class="table table-striped table table-hover" align = "top">
<center>
<thead>
    <tr>
    
    <!-- width 옆에 %는 테이블에서 차지할 비율을 나타낸것 -->
        <th width="10%">게시글 번호</th>
        <th width="20%">제목</th>
        <th width="20">작성자</th>
        <th width="20%">내용</th>
        <th width="20%">날짜</th>
        <th width="10%">조회수</th>
</tr>
</thead>
<tbody>
</center>
        
    <!-- forEach var = "개별데이터" items = "집합데이터" -->
    <c:forEach var = "row" items = "${map.list}"<!-- 컨트롤러에서 map안에 list를 넣었기 때문에 이렇게 받는다. -->
    <tr>
        <td>${row.bno}</td>    <!-- 글번호 -->
        <!-- 클릭하면 컨트롤러의 view.do로 이동하고, 게시물번호, 페이지 번호, 검색옵션, 키워드를 같이 넘긴다 -->
        <td>
        <a href="admin_board_view.do?bno=${row.bno}      
&curPage=${map.pager.curPage}
&search_option=${map.search_option} 
&keyword=${map.keyword}">${row.title}</a>
<c:if test="${row.rcnt > 0}"
   <span style="color:red;">( ${row.rcnt} )</span
</c:if>  
</td>
 
        <td>${row.admin_id}</td>    <!-- 작성자의 이름 -->
        <td>${row.content}</td>    <!-- 글의내용 -->
        <td>${row.reg_date}</td>    <!-- 날짜의 출력형식을 변경함 -->
        <td>${row.viewcnt}</td>    <!-- 조회수 -->
        
 
    
    </tr>
    </c:forEach>
    
    <!-- 페이지 네비게이션 출력 -->
    <tr>
        <td colspan = "7" align = "center">
            <c:if test="${map.pager.curBlock > 1}">
  <a href="#" onclick="list('1')">[처음]</a>
            </c:if<!-- 현재 블록이 1블록보다 크면 (뒤쪽에 있기때문에) 처음으로 갈 수 있도록 링크를 추가 -->
        
            <c:if test="${map.pager.curBlock > 1}">
                <a href="#" onclick="list('${map.pager.prevPage}')">
                [이전]</a>
            </c:if<!-- 현재 블록이 1블록보다 크면 이전 블록으로 이동할 수 있도록 링크 추가 -->
            
            <c:forEach var="num"
                begin="${map.pager.blockBegin}"
                end="${map.pager.blockEnd}">
                <c:choose>
                    <c:when test="${num == map.pager.curPage}">
                    
                    <!-- 현재 페이지인 경우 하이퍼링크 제거 -->
                    <!-- 현재 페이지인 경우에는 링크를 빼고 빨간색으로 처리를 한다. -->
                        <span style="color:red;">${num}</span>
                    </c:when>
                    <c:otherwise>
                        <a href="#" onclick="list('${num}')" >${num}</a>
                    </c:otherwise>
                </c:choose>
            </c:forEach>
            
            
            <c:if test="${map.pager.curBlock <= map.pager.totBlock}">
                <a href="#" onclick="list('${map.pager.nextPage}')">[다음]</a>
            </c:if<!-- 현재 페이지블록이 총 페이지블록보다 작으면 다음으로 갈 수있도록 링크를 추가 -->
            
            
            <c:if test="${map.pager.curPage <= map.pager.totPage}">
                <a href="#" onclick="list('${map.pager.totPage}')">[끝]</a>
            </c:if<!-- 현재 페이지블록이 총 페이지블록보다 작거나 같으면 끝으로 갈 수 있도록 링크를 추가함-->
            </td>
    </tr>
    </tbody>
    </center>
</table>
</div>
 
 
<form name="form1" method="post" action="admin_board_list.do">
    <select name="search_option">
        <option value="admin_id"
<c:if test="${map.search_option == 'admin_id'}">selected</c:if>
        >작성자</option>
        <option value="title" 
<c:if test="${map.search_option == 'title'}">selected</c:if>
        >제목</option>
        <option value="content" 
<c:if test="${map.search_option == 'content'}">selected</c:if>
        >내용</option>
        <option value="all" 
<c:if test="${map.search_option == 'all'}">selected</c:if>
        >작성자+내용+제목</option>
    </select>
    <input name="keyword" value="${map.keyword}">
    <input type="submit" value="조회">
   
   <c:if test="${sessionScope.admin_id != null }">
   <button type = "button" id = "btnWrite" align = "right">글쓰기</button>
   </c:if>
</form>
 
 
 
 
</center>
</body>
</html>
cs



adminboardwrite.jsp 중 일부 (공지사항 쓰기 페이지)


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
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<%@ include file="../include/header.jsp"%>
<%@ include file="../include/menu.jsp"%><br><br>
<script src = "${path}/ckeditor/ckeditor.js"></script>
 
<link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
 
 //디자인 적용 코드
<style>
    #contentForm {
      width: 40%;
      margin: 0 auto;
      padding-top: 12%;
    }
 
    .table > thead > tr > th, .table > tbody > tr > th {
      background-color: #e6ecff;
      text-align: center;
    }
  </style>
  
  
<!-- ckeditor 사용을 위해 js파일을 연결함 -->
<body>
<!-- 글쓰기 폼 작성 -->
<h2>공지사항 작성</h2>
<form method = "post" action = "admin_board_insert.do">
<div class="input-group input-group-sm" role="group" style = "text-align:left">
<table class="table table-striped table-bordered">
<thead>
<tr>
<td><input name = "title" id = "title" size = "80" placeholder = "제목을 입력하세요" class="form-control" aria-describedby="basic-addon1"></td>
</tr>
 
<br><br>
<tr>
<div style = "width:800px;"
<td><textarea class="form-control" id = "content" name = "content" rows = "6" cols = "80" placeholder = "내용을 입력하세요">
</textarea></td>
</div>
</tr>
 
</thead>
</table>
</div>
</div>
<center>
<div class="btn-group btn-group-sm" role="group" aria-label="...">
<div style = "text-align:center;" >
<button type = "submit" name = "submit" class = "btn btn-default">확인</button></div></div>
</center>
 
 
<script>
//id가 description인 태그에 ckeditor을 적용시킴
//이미지 업로드 안됨
CKEDITOR.replace("content");
</script>
 
 
</form>
</body>
</html>
cs



memberboard.jsp (회원게시판 게시글 목록)


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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<%@ include file="../include/header.jsp"%>
<%@ include file="../include/menu.jsp"%>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
 
 
<link rel = "stylesheet" href = "/css/bootstrap.css">
 
//css(디자인 적용)

<style>
    #container {
      width: 70%;
      margin: 0 auto;     /* 가로로 중앙에 배치 */
      padding-top: 10%;   /* 테두리와 내용 사이의 패딩 여백 */
    }
     
    #list {
      text-align: center;
    }
   
    #write {
      text-align: right;
    }
     
    /* Bootstrap 수정 */
    .table > thead {
      background-color: #b3c6ff;
    }
    .table > thead > tr > th {
      text-align: center;
    }
    .table-hover > tbody > tr:hover {
      background-color: #e6ecff;
    }
    .table > tbody > tr > td {
      text-align: center;
    }
    .table > tbody > tr > #title {
      text-align: left;
    }
     
    div > #paging {
      text-align: center;
    }
     
    .hit {
      animation-name: blink;
      animation-duration: 1.5s;
      animation-timing-function: ease;
      animation-iteration-count: infinite;
      /* 위 속성들을 한 줄로 표기하기 */
      /* -webkit-animation: blink 1.5s ease infinite; */
    }
     
    /* 애니메이션 지점 설정하기 */
    /* 익스플로러 10 이상, 최신 모던 브라우저에서 지원 */
    @keyframes blink {
      from {color: white;}
      30% {color: yellow;}
      to {color: red; font-weight: bold;}
      /* 0% {color:white;}
      30% {color: yellow;}
      100% {color:red; font-weight: bold;} */
    }
  </style>
 
 
 
<script>
//게시판 목록 페이지로 이동하게 하는 함수
function list(page){
    console.log("페이지를 이동합니다.");
    location.href="list.do?curPage="+page;
};
 
//글쓰기 폼으로 이동하게 하는 함수
$(function(){    
        $("#btnWrite").click(function(){
            location.href="write.do";
        });
});
 
</script>
 
 
 
<%@ include file="../include/login.jsp"%><br>
    
 
 
<center>
<div id = "list">
<d>회원 게시판</d>
<table class="table table-striped table table-hover" align = "top">
<center>
<thead>
    <tr>
    
        <th width = "10%">게시글 번호</th>
        <th width = "20%">제목</th>
        <th width = "20%">작성자</th>
        <th width = "20%">내용</th>
        <th width = "10%">날짜</th>
        <th width = "10%">조회수</th>
        <th width = "10%">추천수</th>
 
    </tr>
    </thead>
    <tbody>
    
    <!-- forEach var = "개별데이터" items = "집합데이터" -->
    <c:forEach var = "row" items = "${map.list}"<!-- 컨트롤러에서 map안에 list를 넣었기 때문에 이렇게 받는다. -->
    <tr>
        <td>${row.member_bno}</td>    <!-- 글번호 -->
        <!-- 클릭하면 컨트롤러의 view.do로 이동하고, 게시물번호, 페이지 번호, 검색옵션, 키워드를 같이 넘긴다 -->
        <td>
        <a href="view.do?member_bno=${row.member_bno}      
&curPage=${map.pager.curPage}
&search_option=${map.search_option} 
&keyword=${map.keyword}">${row.title}</a>
<c:if test="${row.rcnt > 0}"
   <span style="color:red;">( ${row.rcnt} )</span
</c:if>  
</td>
 
        <td>${row.user_id}</td>    <!-- 작성자의 이름 -->
        <td>${row.content}</td>    <!-- 글의내용 -->
        <td>${row.reg_date}</td>    <!-- 날짜의 출력형식을 변경함 -->
        <td>${row.viewcnt}</td>    <!-- 조회수 -->
        <td>${row.recommend}</td>    <!-- 추천수 -->
 
 
    
    </tr>
    </c:forEach>
    </tbody>
    
    <!-- 페이지 네비게이션 출력 -->
    <tr>
        <td colspan = "7" align = "center">
            <c:if test="${map.pager.curBlock > 1}">
  <a href="#" onclick="list('1')">[처음]</a>
            </c:if<!-- 현재 블록이 1블록보다 크면 (뒤쪽에 있기때문에) 처음으로 갈 수 있도록 링크를 추가 -->
        
            <c:if test="${map.pager.curBlock > 1}">
                <a href="#" onclick="list('${map.pager.prevPage}')">
                [이전]</a>
            </c:if<!-- 현재 블록이 1블록보다 크면 이전 블록으로 이동할 수 있도록 링크 추가 -->
            
            <c:forEach var="num"
                begin="${map.pager.blockBegin}"
                end="${map.pager.blockEnd}">
                <c:choose>
                    <c:when test="${num == map.pager.curPage}">
                    
                    <!-- 현재 페이지인 경우 하이퍼링크 제거 -->
                    <!-- 현재 페이지인 경우에는 링크를 빼고 빨간색으로 처리를 한다. -->
                        <span style="color:red;">${num}</span>
                    </c:when>
                    <c:otherwise>
                        <a href="#" onclick="list('${num}')" >${num}</a>
                    </c:otherwise>
                </c:choose>
            </c:forEach>
            
            
            <c:if test="${map.pager.curBlock <= map.pager.totBlock}">
                <a href="#" onclick="list('${map.pager.nextPage}')">[다음]</a>
            </c:if<!-- 현재 페이지블록이 총 페이지블록보다 작으면 다음으로 갈 수있도록 링크를 추가 -->
            
            
            <c:if test="${map.pager.curPage <= map.pager.totPage}">
                <a href="#" onclick="list('${map.pager.totPage}')">[끝]</a>
            </c:if<!-- 현재 페이지블록이 총 페이지블록보다 작거나 같으면 끝으로 갈 수 있도록 링크를 추가함-->
            </td>
    </tr>
    
    </center>
</table>
</div>
 
 
<form name="form1" method="post" action="list.do">
    <select name="search_option">
        <option value="user_id"
<c:if test="${map.search_option == 'user_id'}">selected</c:if>
        >작성자</option>
        <option value="title" 
<c:if test="${map.search_option == 'title'}">selected</c:if>
        >제목</option>
        <option value="content" 
<c:if test="${map.search_option == 'content'}">selected</c:if>
        >내용</option>
        <option value="all" 
<c:if test="${map.search_option == 'all'}">selected</c:if>
        >작성자+내용+제목</option>
    </select>
    <input name="keyword" value="${map.keyword}">
    <input type="submit" value="조회">
   
   <button type = "button" id = "btnWrite" align = "right">글쓰기</button>
   
</form>
 
 
 
 
</center>
</body>
</html>
cs




memberboardwrite.jsp (회원게시판 게시글 쓰기 페이지)


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
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<%@ include file="../include/header.jsp"%>
<%@ include file="../include/menu.jsp"%><br><br>
<script src = "${path}/ckeditor/ckeditor.js"></script>
 
<link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
 
 <style>
    #contentForm {
      width: 40%;
      margin: 0 auto;
      padding-top: 12%;
    }
 
    .table > thead > tr > th, .table > tbody > tr > th {
      background-color: #e6ecff;
      text-align: center;
    }
  </style>
 
<!-- ckeditor 사용을 위해 js파일을 연결함 -->
<body>
<!-- 글쓰기 폼 작성 -->
<h2>글 작성</h2>
<form method = "post" action = "insert.do">
<div class="input-group input-group-sm" role="group" style = "text-align:left">
<table class="table table-striped table-bordered">
<thead>
<tr>
<td><input name = "title" id = "title" size = "80" placeholder = "제목을 입력하세요" class="form-control" aria-describedby="basic-addon1"></td>
</tr>
 
<br><br>
<tr>
<div style = "width:800px;"
<td><textarea class="form-control" id = "content" name = "content" rows = "6" cols = "80" placeholder = "내용을 입력하세요">
</textarea></td>
</div>
</tr>
 
</thead>
</table>
 
</div>
</div>
<center>
<div class="btn-group btn-group-sm" role="group" aria-label="...">
<div style = "text-align:center;" ><button type = "submit" name = "submit" class="btn btn-default">확인</button></div></div>
</center>
<script>
//id가 description인 태그에 ckeditor을 적용시킴
//이미지 업로드 안됨
CKEDITOR.replace("content");
 
 
 
 
</script>
 
</form>
</body>
</html>
cs




memberboardview.jsp (회원 게시판 게시글 보기)


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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<%@ include file="../include/header.jsp" %>
<%@ include file="../include/menu.jsp" %>
<script src="${path}/include/js/common.js"></script>
<script src="${path}/ckeditor/ckeditor.js"></script>
 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
 
<link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
 
 <style>
    #contentForm {
      width: 40%;
      margin: 0 auto;
      padding-top: 12%;
    }
 
    .table > thead > tr > th, .table > tbody > tr > th {
      background-color: #e6ecff;
      text-align: center;
    }
  </style>
 
 
<script>
$(function(){
    
    //목록 버튼
    $("#btnList").click(function(){
        location.href="list.do";
    });
 
 
    //수정 버튼
    $("#btnUpdate").click(function(){
    if(confirm("수정하시겠습니까?")){
    document.form1.action="update.do";
    document.form1.submit();
            }
        });
 
 
    //댓글쓰기 버튼 (버튼을 눌러서 id값이 넘어와서 실행되는 자바스크립트 구문)
    listReply();
 
        
    $("#btnReply").click(function(){
        if(confirm("댓글을 작성하시겠습니까?")){
    var r_content = $("#r_content").val();    //댓글의 내용
    var member_bno =  "${dto.member_bno}";
    var params = {"r_content" : r_content, "member_bno" : member_bno};
    
    
    $.ajax({
        type: "post"//데이터를 보낼 방식
        url: "reply_insert.do"//데이터를 보낼 url
        data: params, //보낼 데이터
    
        
        complete : function(data){//데이터를 보내는 것이 성공했을 시 출력되는 메시지
            alert("댓글이 등록되었습니다.");
            listReply2();
                }
            });
        }
    });
    
    
 
    
//댓글 목록을 출력하는 함수
function listReply(){
    $.ajax({
        type: "get",    //get방식으로 자료를 전달
        url: "reply_list.do?member_bno=${dto.member_bno}&curPage=${curPage}&search_option=${search_option}&keyword=${keyword}",    //컨트롤러에 있는 list.do로 맵핑되고 게시글 번호도 같이 보낸다.
        success: function(result){    //자료를 보내는것이 성공했을때 출력되는 메시지
            
            //댓글목록을 실행한 결과를 가져온다.
        $("#listReply").html(result);
            }
        });
}
 
 
 
 
function listReply2(){
    $.ajax({
        type: "get",
        contentType: "application/json",
        url: "reply_list_json.do?member_bno=${dto.member_bno}",
        success: function(result){
            console.log(result);
            var output="<table>";
            for(var i in result){
                var repl=result[i].replytext;
                repl = repl.replace(/  /gi,"&nbsp;&nbsp;");//공백처리
                repl = repl.replace(/</gi,"&lt;"); //태그문자 처리
                repl = repl.replace(/>/gi,"&gt;");
                repl = repl.replace(/\n/gi,"<br>"); //줄바꿈 처리
                
                output += "<tr><td>"+result[i].name;
                date = changeDate(result[i].regdate);
                output += "("+date+")";
                output += "<br>"+repl+"</td></tr>";
            }
            output+="</table>";
            $("#listReply").html(output);
        }
    });
}
 
 
 
 
//삭제 버튼
$("#btnDelete").click(function(){
    if(confirm("삭제하시겠습니까?")){
        document.form1.action="delete.do";
        document.form1.submit();
        }
    });
    
    
//추천하기 버튼
$("#btnRecommend").click(function(){
    if(confirm("해당 글을 추천하시겠습니까?")){
        document.form1.action="recommend.do";
        document.form1.submit();
        
        alert("해당 글을 추천하였습니다.")
        
        }
    });
 
    
    
});
 
 
 
</script>
 
<h2>게시물 보기 </h2> 조회수 : ${dto.viewcnt}
<!-- 게시물을 작성하기 위해 컨트롤러의 insert.do로 맵핑 -->
<form id="form1" name="form1" method="post" action="${path}/board/insert.do">
<div class="input-group input-group-sm" role="group" style = "text-align:left">
<table class="table table-striped table-bordered">
<tread>
<tr>
<td><input type = "hidden" id = "member_bno" name = "member_bno" class="form-control" aria-describedby="basic-addon1" value = "${dto.member_bno }" class="form-control" aria-describedby="basic-addon1" >글번호 : ${dto.member_bno }</td>
</tr>
 
 
<tr>
<td><input name="title" id="title" size="80"
                    value="${dto.title}"
                    placeholder="제목을 입력하세요" class="form-control" aria-describedby="basic-addon1" ></td></tr>
                    
<br><br>
                              
<!-- placeholder은 제목을 입력할 수 있도록 도움말을 출력함 -->
<tr>
<div style="width:800px;">
<td><textarea class="form-control" id="content" name="content" rows="3" cols="80" 
placeholder="내용을 입력하세요">${dto.content}</textarea></td>
</div>
</tr>
</tread>
</table>
 
</div>
</div>
 
</form>
 
 
 
<!-- 마찬가지로 내용을 입력하도록 도움말을 출력함 -->
<script>
// ckeditor 적용
//id가 content인 태그 (글의 내용을 입력하는 태그)를 ck에디터를 적용한다는 의미
CKEDITOR.replace("content",{
    height: "300px"
});
 
CKEDITOR.replace("r_content",{
    height: "300px"
});
</script>
 
<div style = "width:700px; text-align:center;">
<!-- 수정, 삭제에 필요한 글번호를 hidden 태그에 저장한다. -->
    <input type = "hidden" name = "member_bno" value = "${dto.member_bno }">
    
    <!-- 본인만 수정, 삭제 버튼을 표시한다. -->
    <c:if test = "${sessionScope.user_id == dto.user_id or sessionScope.navername == dto.user_id or sessionScope.kakaonickname == dto.user_id or sessionScope.facebookname == dto.user_id}">
            <div class="btn-group btn-group-sm" role="group" aria-label="...">
            <div style = "text-align:center;" >
            
            <button type = "submit" id = "btnUpdate" class="btn btn-default">수정</button>
            <button type = "button" id = "btnDelete" class="btn btn-default">삭제</button>
            
            </div></div>
    </c:if>
    
    
    <!-- 관리자에게는 삭제 버튼을 표시한다. -->
    <c:if test = "${sessionScope.admin_id != null}">
    
    <div class="btn-group btn-group-sm" role="group" aria-label="...">
    <div style = "text-align:center;" >
            <button type = "button" id = "btnDelete" class="btn btn-default">삭제</button>
            </div></div>
    </c:if>
    
    
    <!-- 로그인이 되어있고, 본인 글이 아닐경우에만 추천할 수 있도록 버튼을 출력 -->
    <c:if test = "${sessionScope.user_id != null and sessionScope.user_id != dto.user_id
    or sessionScope.navername != null and sessionScope.navername != dto.user_id
    or sessionScope.kakaonickname != null and sessionScope.kakaonickname != dto.user_id
    or sessionScope.facebookname != null and sessionScope.facebookname != dto.user_id}">
    <div class="btn-group btn-group-sm" role="group" aria-label="...">
    <div style = "text-align:center;" >
    
            <button type = "button" id = "btnRecommend" class="btn btn-default" >추천하기</button>
            </div></div>
    
    </c:if>
    
    <!-- 관리자에게도 추천 버튼 출력 -->
    <!-- 관리자에게는 삭제 버튼을 표시한다. -->
    <c:if test = "${sessionScope.admin_id != null}">
    
    <div class="btn-group btn-group-sm" role="group" aria-label="...">
    <div style = "text-align:center;" >
            <button type = "button" id = "btnRecommend" class="btn btn-default" >추천하기</button>
            
            </div></div>
    </c:if>
    
    
    <!-- 글목록은 본인이 아니어도 확인 가능하게 한다. -->
        <div class="btn-group btn-group-sm" role="group" aria-label="...">
    <div style = "text-align:center;" >
    
    <button type = "button" id = "btnList" class="btn btn-default">목록</button>
    </div></div>
    
    <!-- 로그인이 되어있는 상태에서만 댓글 작성 버튼이 출력되도록 한다. -->
    
    <c:if test = "${sessionScope.user_id != null or sessionScope.navername != null 
    or sessionScope.kakaonickname != null or sessionScope.facebookname != null}">
    <br><br><br>
    <div class="btn-group btn-group-sm" role="group" aria-label="...">
    <div style = "text-align:center;" >
    <textarea rows = "5" cols = "80" id = "r_content" name = "r_content"></textarea>
    </div></div>
    <br>
    
    
    <!-- 댓글쓰기 버튼을 클릭하면 위쪽에 있는 자바스크립트 구문이 실행되어서 컨트롤러로 맵핑됨 --><br><br>
    <div class="btn-group btn-group-sm" role="group" aria-label="...">
    <div style = "text-align:center;" >
    
    <button type = "button" id = "btnReply" class="btn btn-default" >댓글쓰기</button>
    </div></div>
    </c:if>
    
    <!-- 댓글 목록 -->
    <!-- 댓글이 등록이 되면 listReply에 댓글이 쌓이게 된다. -->
    <div id = "listReply"></div>
    
<body>
</body>
</html>
cs





:

메인페이지 꾸며보기 (내 프로젝트에 적용)

Front-End/Bootstrap 2019. 10. 4. 17:19

메인페이지 home.jsp 페이지에 디자인을 추가한 글씨를 추가함


home.jsp


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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>메인페이지</title>
<head>
 
 
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <!-- Bootstrap CSS -->
  <link href="/css/bootstrap.css" rel="stylesheet">
<header class="masthead">
<link href="/css/agency.css" rel="stylesheet">
 

- CSS 디자인 설정 -

 <style>
      d {
        font-family: "Arial Black", sans-serif;
        font-size: 45px;
        font-weight: bold;
        color: #ffffff;
      }
      .s3 { text-shadow: 6px 2px 2px gray; }
      
      
       c {
        font-family: "Arial Black", sans-serif;
        font-size: 45px;
        font-weight: bold;
        color: gren;
      }
      
      .s4 { text-shadow: 10px 4px 4px red; }
      
       p {
        margin: 20px;
        padding: 20px 0px;
        text-align: center;
        text-transform: uppercase;
        font-family: "Arial Black", sans-serif;
        font-size: 60px;
        font-weight: bold;
      }
      .s2 {
    
        color: #ffffff;
        text-shadow: 4px 4px 0px #bdbdbd;
      }
      
      
    </style>
  


   
  
    </head>
 
 
<%@ include file="include/header.jsp"%>
<%@ include file="include/menu.jsp"%>
 
<body background = "https://i.pinimg.com/originals/c6/4a/1d/c64a1d3ec620f0550c9211e83bbb0512.jpg">
<br>
<br>
 <Script src="/js/jquery-3.3.1.min.js"></script>
 <Script src="/js/bootstrap.min.js"></script>
 
<p class="s2">welcome to hs_project!!</p>
 
<div style="width: 60%; height:150px; float: right;">
    <center>
    
     <br><br><br><br><br>
    <d class="s3">We Create Value</d><br><br><br><br>
    <d class="s3">With You...</d><br><br><br><br>
    <d class="s3">Now is the time.</d><br><br><br><br>
    <c class="s4">Communicate and share with each other</c><br><br><br><br>
    
    </center>
</div>
 
<div style="width: 30%; height:150px; float: left;">
 
<%@ include file="include/login.jsp"%>
 
</div>
 
     
 
 
</body>
 
<!-- 로그인 실패나 성공시 메시지를 받아서 출력하는 자바스크립트 구문 -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
    $(function(){
        var responseMessage = "<c:out value="${message}" />";
        if (responseMessage != ""){
            alert(responseMessage)
        }
    })
</script>
 
 
<br>
<br>
 
 
</html>
cs




:

전체적으로 bootstrap 적용 (일부)

Front-End/Bootstrap 2019. 10. 2. 16:05


:

로그인 폼에 bootstrap 적용

Front-End/Bootstrap 2019. 10. 2. 16:03

로그인 폼에 bootstrap 적용해보기



login_form.jsp


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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="google-signin-scope" content="profile email">
<meta name="google-signin-client_id" content="576736845363-o0474pib5q69qlcv6lm7o42hs6lu5u59.apps.googleusercontent.com">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name = "viewport" content = "user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,
width=device-width" />
 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
 
<title>Insert title here</title>

//디자인을 설정하기위해 stylesheet 추가함
<link rel = "stylesheet" href = "/css/bootstrap.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
 
 
</head>
<br><br><%@ include file="../include/header.jsp"%>
 
<section>
 
<table border="1" width="300px" class = "table-hover">
 
 
        <div class="card align-middle" style="width:30rem; border-radius:20px;">
        
        <div class="card-body">
 
<!-- 로그인창 -->
<form action ="normale_login.do" method = "post">
<center>
<br>
<input type = "text" name="user_id" placeholder="  ID를 입력하세요 " class="form-control"><br><br>
<input type = "password" name="member_pass" placeholder="  비밀번호를 입력하세요 " class="form-control"><br><br>
<button type = "submit" name = "submit" class="form-control btn btn-primary">로그인</button>
<br>
<br>
</center>
 
<center>
 
<html lang="ko">
<head>
<script type="text/javascript" src="https://static.nid.naver.com/js/naveridlogin_js_sdk_2.0.0.js" width=200px, height=100px charset="utf-8"></script>
</head>
<body>
 
 
 
 
 
 
<br>
<!-- 네이버아이디로로그인 버튼 노출 영역 -->
<div id="naverIdLogin"></div>
<!-- //네이버 아이디로 로그인 버튼 노출 영역 -->
 
<!-- 네이버 아이디로 로그인 초기화 Script -->
<script type="text/javascript">
    var naverLogin = new naver.LoginWithNaverId(
        {
            //클라이언트 id와 콜백 url (결과페이지)
            clientId: "DphfmDygX4WFkf8nghMJ",
            callbackUrl: "http://localhost/hansub_project/login_result",
            isPopup: false/* 팝업을 통한 연동처리 여부 */
            loginButton: {color: "green", type: 3, height: 40/* 로그인 버튼의 타입을 지정 */
        }
    );
    
    /* 설정정보를 초기화하고 연동을 준비 */
    naverLogin.init();
    
</script>
</center>
 
 
</center>
 
<center>
<!-- 카카오톡 아이디 연동해서 로그인 -->
<script src = "//developers.kakao.com/sdk/js/kakao.min.js" width=200px, height=100px ></script>
<a id="kakao-login-btn"></a>
<a href="http://developers.kakao.com/logout"></a>
<script type='text/javascript'>
 
Kakao.init('bd21082a499aaa79b4c08e01935a8a70'); //아까 카카오개발자홈페이지에서 발급받은 자바스크립트 키를 입력함
 
//카카오 로그인 버튼을 생성합니다. 
 
Kakao.Auth.createLoginButton({ 
    container: '#kakao-login-btn'
    success: function(authObj) { 
           Kakao.API.request({
 
               url: '/v1/user/me',
 
               success: function(res) {
 
                     console.log(res.id);//<---- 콘솔 로그에 id 정보 출력(id는 res안에 있기 때문에  res.id 로 불러온다)
 
                     console.log(res.kaccount_email);//<---- 콘솔 로그에 email 정보 출력 (어딨는지 알겠죠?)
 
                     console.log(res.properties['nickname']);//<---- 콘솔 로그에 닉네임 출력(properties에 있는 nickname 접근 
                             
                 // res.properties.nickname으로도 접근 가능 )
                     console.log(authObj.access_token);//<---- 콘솔 로그에 토큰값 출력
          
          var id = res.id;    //카카오톡 닉네임을 변수에 저장
          var kakaonickname = res.properties.nickname;    //카카오톡 닉네임을 변수에 저장
          var kakaoe_mail = res.kaccount_email;    //카카오톡 이메일을 변수에 저장함
         
          
 
          window.location.replace("http://" + window.location.hostname + ( (location.port==""||location.port==undefined)?"":":" + location.port) + "/hansub_project/home?kakaonickname="+kakaonickname+"kakaotalk"+"&kakaoe_mail="+kakaoe_mail);
      
                   }
                 })
               },
               fail: function(error) {
                 alert(JSON.stringify(error));
               }
             });
</script>
</center>
 
 
<!-- 페이스북 아이디를 연동해서 로그인 -->
 
 <center>
<button type= "button" id= "loginBtn" ><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQwsKoAUt9rmyFjqv055BANDSiVlqNsu-kOF2NKwpGzOgWFwiqD" width=200px, height=50px /></button>
 </center>
 
            <div id="access_token"></div>
            <div id="user_id"></div>
            <div id="name"></div>
            <div id="email"></div>
            <div id="gender"></div>
            <div id="birthday"></div>
            <div id="id"></div>            
            
<script>
function getUserData() {
    /* FB.api('/me', function(response) {
        document.getElementById('response').innerHTML = 'Hello ' + response.name;
        console.log(response);
    }); */
    FB.api('/me', {fields: 'name,email'}, function(response) {
        
        var facebookname = response.name;    //페이스북 아이디를 변수에 저장함
        var facebooke_mail = response.email;    //페이스북 이메일을 변수에 저장함
        
        
        window.location.replace("http://" + window.location.hostname + ( (location.port==""||location.port==undefined)?"":":" + location.port) + "/hansub_project/home?facebookname="+encodeURI(facebookname)+"&facebooke_mail="+facebooke_mail);
 
    });
}
  
window.fbAsyncInit = function() {
    //SDK loaded, initialize it
    FB.init({
        appId      : '488986078336253'//페이스북 개발자 홈페이지에서 앱을 등록하고, 앱 id를 받아온다.
        cookie     : true,  // enable cookies to allow the server to access
                // the session
        xfbml      : true,  // parse social plugins on this page
        version    : 'v3.3'     // 페이스북 개발자 홈페이지에서 버전을 확인한 후 작성한다.
    });
  
    //check user session and refresh it
    FB.getLoginStatus(function(response) {
        if (response.status === 'connected') {        //만약 정상적으로 실행되었다면 유저의 데이터를 가져온다.
            //user is authorized
            //document.getElementById('loginBtn').style.display = 'none';
            getUserData(); 
            
        
            
        } else {
            //user is not authorized
        }
    });
};
  
//load the JavaScript SDK
(function(d, s, id){
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.com/ko_KR/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document'script''facebook-jssdk'));
  
//add event listener to login button
document.getElementById('loginBtn').addEventListener('click'function() {
    //do the login
    FB.login(function(response) {
        if (response.authResponse) {
            access_token = response.authResponse.accessToken; //get access token
            user_id = response.authResponse.userID; //get FB UID
            console.log('access_token = '+access_token);
            console.log('user_id = '+user_id);
            //user just authorized your app
            //document.getElementById('loginBtn').style.display = 'none';
            getUserData();
        }
    }, {scope: 'email,public_profile,user_birthday',
        return_scopes: true});
}, false);
 
 
 
</script>
 
 
 
</form>
<br>
<!-- 아이디 찾기 -->
<!-- 위치를 왼쪽으로 고정시키고, 45퍼센트만큼 떨어짐 -->

<div style= "width:45%; float:left;">
<form action ="find.user_id.do">
<center>
<button class = "btn btn-default btn-block">아이디 찾기</button>
</center>
</form>
</div>
 
<!-- 비밀번호 찾기 -->
<!-- 위치를 오른쪽으로 고정시키고, 45퍼센트 만큼공간을 차지함. 두개의 버튼은 총 10퍼센트 만큼 떨어져 있는것. -->

<div style= "width:45%; float:right;">
<form action ="find.member_pass.do">
<center>
<button class = "btn btn-default btn-block">비밀번호 찾기</button>
<br>
</center>
</form>
<br>
</div>
<br>
 
</td>
<br>
</tr>
</div>
 
<br>
<br>
</div>
</div>
</div>
</table>
</section>
 
 
<body>
<!-- 로그인 실패나 성공시 메시지를 받아서 출력하는 자바스크립트 구문 -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
    $(function(){
        var responseMessage = "<c:out value="${message}" />";
        if (responseMessage != ""){
            alert(responseMessage)
        }
    })
</script>
 
 
</body>
</html>
cs




login.jsp (마찬가지로 버튼에 이미지를 적용함)


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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<%@ include file="header.jsp"%>
 
 
<body>
<br>

<!-- 세션에 id값이 저장되어 있는 경우 로그아웃 버튼과 로그인한 아이디가 출력되도록 코드를 작성함 -->
 
<c:if test = "${sessionScope.user_id != null}">
 
<span style="color: black; font-weight: bold;">(일반)${sessionScope.user_id}님이 로그인 하셨습니다.</span><br><br>
 
<form action = "logout.do" method = "post">
<button type = "submit" name = "submit" class="btn btn-primary">로그아웃</button></form><br><br>
 
<form action = "member_profile.do" method = "post">
<button type = "submit" name = "submit" class = "btn btn-primary">나의 프로필 확인</button></form><br><br>
 
 
</c:if>
 
 
<c:if test = "${sessionScope.navername != null}">
 
<span style="color: black; font-weight: bold;">(네이버)${sessionScope.navername}님이 로그인 하셨습니다.</span><br><br>
 
<form action = "naver_logout.do" method = "post">
<button type = "submit" name = "submit" class="btn btn-primary">로그아웃</button></form><br><br>
 
<form action = "authentication.do" method = "post">
<button type = "submit" name = "submit" class = "btn btn-primary">회원 인증하기 (인증을 해야 각종 기능들 사용 가능)</button></form><br><br>
 
<form action = "naver_member_profile.do" method = "post">
<button type = "submit" name = "submit" class = "btn btn-primary">나의 프로필 확인</button></form><br><br>
 
</c:if>
 
 
<c:if test = "${sessionScope.kakaonickname != null}">
 
<span style="color: black; font-weight: bold;">(카카오톡)${sessionScope.kakaonickname}님이 로그인 하셨습니다.</span><br><br>
 
<form action = "kakao_logout.do" method = "post">
<button type = "submit" name = "submit" class="btn btn-primary">로그아웃</button></form><br><br>
 
<form action = "authentication.do" method = "post">
<button type = "submit" name = "submit" class = "btn btn-primary">회원 인증하기 (인증을 해야 각종 기능들 사용 가능)</button></form><br><br>
 
<form action = "kakao_member_profile.do" method = "post">
<button type = "submit" name = "submit" class = "btn btn-primary">나의 프로필 확인</button></form><br><br>
 
</c:if>
 
 
 
<c:if test = "${sessionScope.facebookname != null}">
 
<span style="color: black; font-weight: bold;">(페이스북)${sessionScope.facebookname}님이 로그인 하셨습니다.</span><br><br>
 
<form action = "facebook_logout.do" method = "post">
<button type = "submit" name = "submit" class="btn btn-primary">로그아웃</button></form><br><br>
 
 
<form action = "authentication.do" method = "post">
<button type = "submit" name = "submit" class = "btn btn-primary">회원 인증하기 (인증을 해야 각종 기능들 사용 가능)</button></form><br><br>
 
<form action = "facebook_member_profile.do" method = "post">
<button type = "submit" name = "submit" class = "btn btn-primary">나의 프로필 확인</button></form><br><br>
 
</c:if>
 
 
<c:if test = "${sessionScope.admin_id != null}">
 
<span style="color: black; font-weight: bold;">(관리자)${sessionScope.admin_id}님이 로그인 하셨습니다.</span><br><br>
 
<form action = "logout.do" method = "post">
<button type = "submit" name = "submit" class="btn btn-primary">로그아웃</button></form><br><br>
 
 
</c:if>
 
 
 
 
<c:if test = "${sessionScope.user_id == null and sessionScope.navername == null and sessionScope.kakaonickname == null and sessionScope.facebookname == null and sessionScope.admin_id == null}">
 
<%
//url로 보낸 아이디를 세션에 저장하기 위해 변수에 저장함
String navername = request.getParameter("navername");
String kakaonickname = request.getParameter("kakaonickname");
String facebookname = request.getParameter("facebookname");
String normalname = request.getParameter("user_id");
String admin_id = request.getParameter("admin_id");
 
 
//url로 보낸 이메일를 세션에 저장하기 위해 변수에 저장함
String navere_mail = request.getParameter("navere_mail");
String kakaoe_mail = request.getParameter("kakaoe_mail");
String facebooke_mail = request.getParameter("facebooke_mail");
 
%>    
 
 
<%
//아이디를 세션에 저장
session.setAttribute("navername", navername);
session.setAttribute("kakaonickname", kakaonickname);
session.setAttribute("facebookname", facebookname);
session.setAttribute("normalname", normalname);
session.setAttribute("admin_id", admin_id);
 
 
//이메일을 세션에 저장
session.setAttribute("navere_mail", navere_mail);
session.setAttribute("kakaoe_mail", kakaoe_mail);
session.setAttribute("facebooke_mail", facebooke_mail);
 
 
if (navername == null && kakaonickname == null && facebookname == null && normalname == null && admin_id == null) {
    
%>
 
<span style="color: black; font-weight: bold;">(guest)님 방문을 환영합니다.</span><br><br>
                                
                                
<span style="color: black; font-weight: bold;">로그인을 하셔야 다른 기능을 정상적으로 이용하실 수 있습니다.</span><br>
        
    <%@ include file="../member/login_form.jsp"%><br>
    
<%
 
    } 
 
%>
    
    
    </c:if>
 
</body>
</html>
cs






:

메뉴바에 Bootstrap 적용

Front-End/Bootstrap 2019. 10. 2. 15:44

메뉴바에 마우스를 올리면 해당 메뉴의 색깔이 변하면서 하위 메뉴를 출력하도록 설정함



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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!-- views/include/menu.jsp -->
<%@ include file="header.jsp"%>
<head>

//디자인을 사용하기위해 bootstrap를 stylesheet로 링크를 건다
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js%22"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
 
<link rel = "stylesheet" href = "/css/bootstrap.css">
 
 
</head>
 
<style>
.menubar li ul {
background: rgb(109,109,109);
display:none;  /* 평상시에는 서브메뉴가 안보이게 하기 */
height:auto;
padding:0px;
margin:0px;
border:0px;
position:absolute;
width:200px;
z-index:200;
}
.dropbtn{
  background-color: black;
  color: white;
  padding: 16px;
  font-size: 16px;
  border: none;
}
.dropbtn b{
  background-color: red;
  color: white;
  padding: 16px;
  font-size: 16px;
  border: none;
}
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f1f1f1;
  min-width: 150px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
}
.dropdown-content b {
  display: none;
  position: absolute;
  background-color: #f1f1f1;
  min-width: 800px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
}
.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}
.dropdown-content a:hover {background-color: #ddd;}
.dropdown:hover .dropdown-content {display: block;}
.dropdown:hover .dropbtn {background-color: #3e8e41;}
 
 
</style>
 
 
<center>
    <body>
        <nav class="navbar navbar-inverse">
            <div class="container-fluid">
                <div class="navbar-header">
                    <a class="navbar-brand" href="#">Hs-Project</a>
                </div>
 
                <div>
                    <!-- 다른 기능들 링크가 걸려있는 메뉴 페이지 -->
                    <ul class="nav navbar-nav">
                        <li class="active"><a href="${path}/home">Home</a></li>
                    
 
 
                <div class="dropdown">
                <button class="dropbtn">게시판</button>
                    <div class="dropdown-content">
                        <a href="${path}/board/list.do">회원 게시물</a>
                        <a href="${path}/board/best_list.do">베스트 게시물</a>
                    </div>
                </div>
    
                    <!-- 어떠한 아이디로든 로그인되지 않았을 경우에만 회원가입 링크를 출력시킨다. -->
                    <c:if
                        test="${sessionScope.user_id == null and sessionScope.navername == null and sessionScope.kakaonickname == null and sessionScope.facebookname == null and sessionScope.admin_id == null}">
                        <div class="dropdown">
                        <button class="dropbtn">회원</button>
                        <div class="dropdown-content">
                        <a href="${path}/member/email.do">회원가입</a>
                    </div>
                </div>
                    </c:if>
 
 
 
                    <!-- 관리자가 로그인 하지 않았을 경우에만 로그인 링크를 출력시킴 -->
                    <c:if
                        test="${sessionScope.user_id == null and sessionScope.navername == null and sessionScope.kakaonickname == null and sessionScope.facebookname == null and sessionScope.admin_id == null}">
                        
                        <div class="dropdown">
                        <button class="dropbtn">로그인</button>
                        <div class="dropdown-content">
                        <a href="${path}/admin/admin_login_view.do">관리자 로그인</a>
                        </div>
                        </div>
                    </c:if>
                    
                    
                        <div class="dropdown">
                        <button class="dropbtn">기타 기능</button>
                        <div class="dropdown-content">
                        <a href="${path}/member/smsform.do">문자 보내기</a>
                        <a href="${path}/member/e_mailform.do">이메일 보내기</a>
                        </div>
                        </div>
 
 
                        <div class="dropdown">
                        <button class="dropbtn">필독!!</button>
                        <div class="dropdown-content">
                    <a href="${path}/board/admin_board_list.do">회원 공지사항</a>
                        </div>
                        </div>
 
 
                    <c:if test="${sessionScope.admin_id != null}">
 
                        <div class="dropdown">
                        <button class="dropbtn">관리자 메뉴</button>
                            <div class="dropdown-content">
                                <a href="${path}/admin/admin_member_forced_eviction_view.do">회원강제 탈퇴</a>
                                <a href="${path}/admin/admin_member_info.do">회원 정보</a>
                        </div>
                    </div>
                    
                        
                    
                    
                        
                    
                    
                    </c:if>
                    
                    </ul>
                    
                    <div class="dropdown">
                        <button class="dropbtn b">만든이</button>
                            <div class="dropdown-content b">
                            <br><br>
                            <span style="color: green; font-weight: bold;">- 홈페이지 작성자 -</span>    <br><br>
                            이한섭 <br><br>
                            
                            <span style="color: green; font-weight: bold;">- 이메일 주소 -</span><br><br>
                            dlgkstjq623@naver.com <br><br>
                            
                            <span style="color: green; font-weight: bold;">- 휴대폰 번호 -</span><br><br>
                            010-7285-1455 <br><br>
                            
                        </div>
                    </div>
                    
                    
                </div>
            </div>
            
            
        </nav>
 
    </body>
    
</center>
 
</html>
cs






:

Bootstrap 다운 및 스프링 프로젝트에 적용

Front-End/Bootstrap 2019. 9. 27. 15:05


1. http://bootstrapk.com/getting-started/#download 에 접속후 사진과 같이 부트스트랩 다운로드





2. 압축을 풀고, 아래 사진과 같이 resources 폴더 하위에 css폴더와, fonts폴더, js폴더를 저장한다.





3. servlet-context.xml 중 일부, resourcess가 맵핑될 수 있도록 맵핑 코드 추가


1
2
3
4
<resources mapping="/css/**" location="/resources/css/" /> 
<resources mapping="/images/**" location="/resources/images/" /> 
<resources mapping="/js/**" location="/resources/js/" /> 
<resources mapping="/resources/**" location="/resources/" /> 
cs



4. 마지막으로 사용할 때는 jsp 파일에 css파일의 링크를 걸고 사용할 디자인들을 <style> 태그 안에 넣어서 사용하면 된다.


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
<link rel = "stylesheet" href = "/css/bootstrap.css">
 
  <style>
    #container {
      width: 70%;
      margin: 0 auto;     /* 가로로 중앙에 배치 */
      padding-top: 10%;   /* 테두리와 내용 사이의 패딩 여백 */
    }
     
    #list {
      text-align: center;
    }
   
    #write {
      text-align: right;
    }
     
    /* Bootstrap 수정 */
    .table > thead {
      background-color: #b3c6ff;
    }
    .table > thead > tr > th {
      text-align: center;
    }
    .table-hover > tbody > tr:hover {
      background-color: #e6ecff;
    }
    .table > tbody > tr > td {
      text-align: center;
    }
    .table > tbody > tr > #title {
      text-align: left;
    }
     
    div > #paging {
      text-align: center;
    }
     
    .hit {
      animation-name: blink;
      animation-duration: 1.5s;
      animation-timing-function: ease;
      animation-iteration-count: infinite;
      /* 위 속성들을 한 줄로 표기하기 */
      /* -webkit-animation: blink 1.5s ease infinite; */
    }
     
    /* 애니메이션 지점 설정하기 */
    /* 익스플로러 10 이상, 최신 모던 브라우저에서 지원 */
    @keyframes blink {
      from {color: white;}
      30% {color: yellow;}
      to {color: red; font-weight: bold;}
      /* 0% {color:white;}
      30% {color: yellow;}
      100% {color:red; font-weight: bold;} */
    }
  </style>
cs


: