웹시큐어코딩 적용 및 코드 정리, CSS, JS 추가보완

This commit is contained in:
KNKIM 2021-07-29 14:13:37 +09:00
parent 42e0c9b79a
commit 7ccba8a51f
7 changed files with 149 additions and 123 deletions

View File

@ -4,6 +4,7 @@
<!-- 상세내용 --> <!-- 상세내용 -->
<articleNo>5</articleNo> <articleNo>5</articleNo>
<articleType>101</articleType> <articleType>101</articleType>
<articleTypeName>Q&amp;A</articleTypeName>
<title>공지사항 테스트</title> <title>공지사항 테스트</title>
<articlePassword>111</articlePassword> <articlePassword>111</articlePassword>
<readCount>15</readCount> <readCount>15</readCount>
@ -23,6 +24,7 @@
<results> <results>
<articleNo>4</articleNo> <articleNo>4</articleNo>
<articleType>101</articleType> <articleType>101</articleType>
<articleTypeName>Q&amp;A</articleTypeName>
<title>이전의 글제목입니다.</title> <title>이전의 글제목입니다.</title>
<regDate>2021-07-19</regDate> <regDate>2021-07-19</regDate>
<regUserName>김아무</regUserName> <regUserName>김아무</regUserName>
@ -31,6 +33,7 @@
<results> <results>
<articleNo>6</articleNo> <articleNo>6</articleNo>
<articleType>102</articleType> <articleType>102</articleType>
<articleTypeName>Q&amp;A</articleTypeName>
<title>다음의 글제목입니다.</title> <title>다음의 글제목입니다.</title>
<regDate>2021-07-20</regDate> <regDate>2021-07-20</regDate>
<regUserName>홍아무</regUserName> <regUserName>홍아무</regUserName>

View File

@ -178,6 +178,8 @@ public class BoardController extends NlibCommonController
String searchKeyword = paramMap.get("searchKeyword"); String searchKeyword = paramMap.get("searchKeyword");
String pageIndex = paramMap.get("pageIndex"); String pageIndex = paramMap.get("pageIndex");
String pageSize = paramMap.get("pageSize"); String pageSize = paramMap.get("pageSize");
String message = paramMap.get("message");
// 게시물 번호 // 게시물 번호
String articleNo = paramMap.get("articleNo"); String articleNo = paramMap.get("articleNo");
@ -186,6 +188,7 @@ public class BoardController extends NlibCommonController
log.debug("selectQnA > pageSize = " + pageSize); log.debug("selectQnA > pageSize = " + pageSize);
log.debug("selectQnA > searchKeyword = " + searchKeyword); log.debug("selectQnA > searchKeyword = " + searchKeyword);
log.debug("selectQnA > articleNo = " + articleNo); log.debug("selectQnA > articleNo = " + articleNo);
log.debug("selectQnA > message = " + message);
//------------------------------- //-------------------------------
// REQ VO 구성 // REQ VO 구성
@ -209,6 +212,7 @@ public class BoardController extends NlibCommonController
model.addAttribute("article" , resVO.getInfo()); model.addAttribute("article" , resVO.getInfo());
model.addAttribute("preArticle" , resVO.getList().get(0)); model.addAttribute("preArticle" , resVO.getList().get(0));
model.addAttribute("nextArticle" , resVO.getList().get(1)); model.addAttribute("nextArticle" , resVO.getList().get(1));
model.addAttribute("message" , message);
model.addAttribute("pageIndex" , pageIndex); model.addAttribute("pageIndex" , pageIndex);
model.addAttribute("pageSize" , pageSize); model.addAttribute("pageSize" , pageSize);
@ -398,6 +402,7 @@ public class BoardController extends NlibCommonController
model.addAttribute("pageIndex" , pageIndex); model.addAttribute("pageIndex" , pageIndex);
model.addAttribute("pageSize" , pageSize); model.addAttribute("pageSize" , pageSize);
model.addAttribute("searchKeyword", searchKeyword); model.addAttribute("searchKeyword", searchKeyword);
model.addAttribute("message" , "");
return "redirect:nlib/board/selectQnA"; return "redirect:nlib/board/selectQnA";
} }

View File

@ -100,7 +100,7 @@ $( document ).ready(function() {
var articleNo = getData["articleNo"]; var articleNo = getData["articleNo"];
// 상세 내용 보기 // 상세 내용 보기
fn_view_detail(articleNo); fn_viewDetail(articleNo);
}, },
//====================================== //======================================
@ -117,29 +117,36 @@ $( document ).ready(function() {
// 페이지 크기 변경시 재조회 // 페이지 크기 변경시 재조회
$("#pageSize").on("change", function(e) { $("#pageSize").on("change", function(e) {
fn_search_article($("#pageSize").val(), 1); fn_searchArticle($("#pageSize").val(), 1);
}); });
// 검색 버튼 클릭 // 검색 버튼 클릭
$("#btnSearch").on("click", function(e) { $("#btnSearch").on("click", function(e) {
fn_search_article($("#pageSize").val(), 1); fn_searchArticle($("#pageSize").val(), 1);
}); });
//초기 자료 조회 //초기 자료 조회
fn_search_article(); fn_searchArticle();
}); // document ready }); // document ready
// 선택한 게시글 상세 보기로 이동 // 선택한 게시글 상세 보기로 이동
function fn_view_detail(articleNo) { function fn_viewDetail(articleNo) {
$("#articleNo").val(articleNo); $("#articleNo").val(articleNo);
$("#articleForm").attr("action", "${pageContext.request.contextPath}/board/selectQnA.do"); $("#articleForm").attr("action", "${pageContext.request.contextPath}/board/selectQnA.do");
$("#articleForm").submit(); $("#articleForm").submit();
} }
// 게시글 작성으로 이동
function fn_newArticle() {
$("#articleNo").val("");
$("#articleForm").attr("action", "${pageContext.request.contextPath}/board/insertQnAForm.do");
$("#articleForm").submit();
}
// 그리드 데이터 조회 호출 // 그리드 데이터 조회 호출
function fn_search_article(pageSize, pageIndex) { function fn_searchArticle(pageSize, pageIndex) {
$("#jsGrid").jsGrid("search" $("#jsGrid").jsGrid("search"
, {'pageSize' : (pageSize ? pageSize : fn_getIntValue("pageSize", ${pageSize}) ), , {'pageSize' : (pageSize ? pageSize : fn_getIntValue("pageSize", ${pageSize}) ),
'pageIndex' : (pageIndex ? pageIndex : fn_getIntValue("pageIndex", 1)) 'pageIndex' : (pageIndex ? pageIndex : fn_getIntValue("pageIndex", 1))
@ -173,7 +180,7 @@ function fn_search_article(pageSize, pageIndex) {
<button type="button" name="btnNew" id="btnNew" class="float" title="글쓰기버튼" <button type="button" name="btnNew" id="btnNew" class="float" title="글쓰기버튼"
onclick="javascript:location.href='${pageContext.request.contextPath}/board/insertQnAForm.do';">글쓰기</button> onclick="fn_newArticle()">글쓰기</button>
<input type="text" name="articleNo" id="articleNo" value="" title="선택글번호" readonly /> <input type="text" name="articleNo" id="articleNo" value="" title="선택글번호" readonly />

View File

@ -34,52 +34,47 @@
<c:set var="pageTitle">묻고답하기 - 상세조회</c:set> <c:set var="pageTitle">묻고답하기 - 상세조회</c:set>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="ko">
<head> <head>
<title>${pageTitle}</title> <title>${pageTitle}</title>
<!-- GRID -->
<link type="text/css" rel="stylesheet" href="/nlib/js/jsgrid/nlib-jsgrid.css" />
<link type="text/css" rel="stylesheet" href="/nlib/js/jsgrid/nlib-jsgrid-theme.css" />
<script src="/nlib/js/jsgrid/nlib-jsgrid.js"></script>
</head> </head>
<body> <body>
<h1>${pageTitle }</h1> <h1>${pageTitle }</h1>
<span style="color:red;">${message }</span> 메시지 : <span style="color:red;">${message }</span>
<br /> <br />
<form name="articleForm" id="articleForm" <form name="articleForm" id="articleForm"
action="${pageContext.request.contextPath}/board/listQnAs.do" action="${pageContext.request.contextPath}/board/listQnAs.do"
method="post"> method="post">
<!-- HIDDEN 영역 : 시작 -->
<input type="text" name="pageIndex" id="pageIndex" title="페이지번호" value="${pageIndex}" readonly />
<input type="text" name="pageSize" id="pageSize" title="목록에 보여줄 글개수" value="${pageSize}" readonly />
<input type="text" name="searchKeyword" id="searchKeyword" title="검색어" value="${searchKeyword}" readonly />
<input type="text" name="articleNo" id="articleNo" title="선택글번호" value="${articleNo}" readonly />
<input type="text" name="articlePassword" id="articlePassword" title="글비밀번호" value="${articlePassword}" readonly />
<!-- HIDDEN 영역 : 종료 -->
<input type="text" name="pageIndex" id="pageIndex" title="페이지번호" value="${pageIndex}" size="5" maxlength="5" readonly /> <table class="table_content" style="width:100% !important; margin-top: 20px;">
<input type="text" name="pageSize" id="pageSize" title="목록에 보여줄 글 개" value="${pageSize}" size="5" maxlength="5" readonly />
<input type="text" name="searchKeyword" id="searchKeyword" title="검색어" value="${searchKeyword}" size="35" maxlength="50" readonly />
<input type="text" name="articleNo" id="articleNo" value="${articleNo}" title="선택글번호" readonly />
<input type="text" name="articlePassword" id="articlePassword" value="${articlePassword}" title="글비밀번호" readonly />
<table class="table_content" style="width:100% !important;">
<tr> <tr>
<td>유형</td> <th>유형</th>
<td>Q & A</td> <td>${article.articleTypeName }</td>
<td>작성자 : ${article.regUserName }</td> <th>작성자 : ${article.regUserName }</th>
<td>작성일 : ${article.regDate }</td> <th>작성일 : ${article.regDate }</th>
<td>상태 : ${article.repStatus }</td> <th>상태 : ${article.repStatus }</th>
</tr> </tr>
<tr> <tr>
<td rowspan="2">질문내용</td> <th rowspan="2">질문내용</th>
<td colspan="4">${article.contentQeust}</td> <td colspan="4">${article.contentQeust}</td>
</tr> </tr>
<tr> <tr>
<td colspan="4">${article.contentQeustFile}</td> <td colspan="4">${article.contentQeustFile}</td>
</tr> </tr>
<tr> <tr>
<td rowspan="2">답변내용</td> <th rowspan="2">답변내용</th>
<td colspan="4">${article.contentReply}</td> <td colspan="4">${article.contentReply}</td>
</tr> </tr>
<tr> <tr>
@ -91,20 +86,20 @@
<table class="table_content" style="width:100% !important;"> <table class="table_content" style="width:100% !important;">
<tr> <tr>
<td>이전글</td> <th>이전글</th>
<td>Q&A</td> <td>${preArticle.articleTypeName }</td>
<td><a href=#" onclick="fn_view_detail('${preArticle.articleNo }')">${preArticle.title }</a></td> <td><a href="javascript:void(0)" onclick="fn_view_detail('${preArticle.articleNo }')">${preArticle.title }</a></td>
<td>작성자 : ${preArticle.regUserName }</td> <th>작성자 : ${preArticle.regUserName }</th>
<td>작성일 : ${preArticle.regDate }</td> <th>작성일 : ${preArticle.regDate }</th>
<td>상태 : ${preArticle.repStatus }</td> <th>상태 : ${preArticle.repStatus }</th>
</tr> </tr>
<tr> <tr>
<td>다음글</td> <th>다음글</th>
<td>Q&A</td> <td>${nextArticle.articleTypeName }</td>
<td><a href=#" onclick="fn_view_detail('${nextArticle.articleNo }')">${nextArticle.title }</a></td> <td><a href="javascript:void(0)" onclick="fn_view_detail('${nextArticle.articleNo }')">${nextArticle.title }</a></td>
<td>작성자 : ${nextArticle.regUserName }</td> <th>작성자 : ${nextArticle.regUserName }</th>
<td>작성일 : ${nextArticle.regDate }</td> <th>작성일 : ${nextArticle.regDate }</th>
<td>상태 : ${nextArticle.repStatus }</td> <th>상태 : ${nextArticle.repStatus }</th>
</tr> </tr>
</table> </table>
@ -148,7 +143,7 @@ function fn_updateForm(passwd) {
// 게시글 수정 화면으로 이동 // 게시글 수정 화면으로 이동
function fn_updatePassword() { function fn_updatePassword() {
fn_promptPassword("비밀번호를 입력하여 주시기 바랍니다.", "fn_updateForm") fn_promptPassword("비밀번호를 입력하여 주시기 바랍니다.", "111", "fn_updateForm")
} }
</script> </script>

View File

@ -43,69 +43,10 @@
<link type="text/css" rel="stylesheet" href="/nlib/js/jsgrid/nlib-jsgrid-theme.css" /> <link type="text/css" rel="stylesheet" href="/nlib/js/jsgrid/nlib-jsgrid-theme.css" />
<script src="/nlib/js/jsgrid/nlib-jsgrid.js"></script> <script src="/nlib/js/jsgrid/nlib-jsgrid.js"></script>
</head>
<body>
<h1>${pageTitle }</h1>
<span style="color:red;">${message }</span>
<br />
<form name="articleForm" id="articleForm"
action="${pageContext.request.contextPath}/board/listQnAs.do"
method="post">
<input type="text" name="pageIndex" id="pageIndex" title="페이지번호" value="${pageIndex}" size="5" maxlength="5" readonly />
<input type="text" name="pageSize" id="pageSize" title="목록에 보여줄 글 개" value="${pageSize}" size="5" maxlength="5" readonly />
<input type="text" name="searchKeyword" id="searchKeyword" title="검색어" value="${searchKeyword}" size="35" maxlength="50" readonly />
<input type="text" name="articleNo" id="articleNo" value="${articleNo}" title="선택글번호" readonly />
<input type="text" name="articlePassword" id="articlePassword" value="${articlePassword}" title="글비밀번호" readonly />
<table class="table_content" style="width:100% !important;">
<tr>
<td>제목</td>
<td><input type="text" name="title" id="title" title="제목" value="${article.title}" size="100" maxlength="200" /></td>
</tr>
<tr>
<td>작성자</td>
<td><input type="text" name="regUserName" id="regUserName" title="제목" value="${article.regUserName}" size="100" maxlength="200" /></td>
</tr>
<tr>
<td>이메일</td>
<td><input type="text" name="email" id="email" title="이메일" value="${article.email}" size="100" maxlength="200" /></td>
</tr>
<tr>
<td>기존비밀번호</td>
<td><input type="text" name="encArticlePassword" id="encArticlePassword" title="제목" value="${encArticlePassword}" size="100" maxlength="200" readonly /></td>
</tr>
<tr>
<td>비밀번호</td>
<td><input type="text" name="articlePassword" id="articlePassword" title="비밀번호" value="${article.articlePassword}" size="100" maxlength="200" /></td>
</tr>
<tr>
<td>질문내용</td>
<td><textarea name="contentQeust" id="contentQeust">${article.contentQeust}</textarea></td>
</tr>
</table>
<br/>
<button type="button" name="btnNew" id="btnNew" class="float"
onclick="fn_view_detail('${articleNo}')">취소</button>
<button type="button" name="btnNew" id="btnNew" class="float"
onclick="fn_update()">저장</button>
</form>
<script type="text/javaScript" language="javascript"> <script type="text/javaScript" language="javascript">
//선택한 게시글 상세 보기로 이동 //선택한 게시글 상세 보기로 이동
function fn_view_detail(articleNo) { function fn_viewDetail(articleNo) {
$("#articleNo").val(articleNo); $("#articleNo").val(articleNo);
$("#articleForm").attr("action", "${pageContext.request.contextPath}/board/selectQnA.do"); $("#articleForm").attr("action", "${pageContext.request.contextPath}/board/selectQnA.do");
$("#articleForm").submit(); $("#articleForm").submit();
@ -138,6 +79,64 @@ function fn_update() {
} }
</script> </script>
</head>
<body>
<h1>${pageTitle }</h1>
메시지 : <span style="color:red;">${message }</span>
<br />
<form name="articleForm" id="articleForm"
action="${pageContext.request.contextPath}/board/upateQnA.do"
method="post">
<!-- HIDDEN 영역 : 시작 -->
<input type="text" name="pageIndex" id="pageIndex" title="페이지번호" value="${pageIndex}" readonly />
<input type="text" name="pageSize" id="pageSize" title="목록에 보여줄 글 개수" value="${pageSize}" readonly />
<input type="text" name="searchKeyword" id="searchKeyword" title="검색어" value="${searchKeyword}" readonly />
<input type="text" name="articleNo" id="articleNo" title="선택글번호" value="${articleNo}" readonly />
<input type="text" name="articlePassword" id="articlePassword" title="글비밀번호" value="${articlePassword}" readonly />
&nbsp;<br/>
&nbsp;<br/>
<table class="table_content" style="width:100% !important;">
<tr>
<th>제목</th>
<td><input type="text" name="title" id="title" title="제목" value="${article.title}" size="100" maxlength="200" required /></td>
</tr>
<tr>
<th>작성자</th>
<td><input type="text" name="regUserName" id="regUserName" title="제목" value="${article.regUserName}" size="100" maxlength="200" /></td>
</tr>
<tr>
<th>이메일</th>
<td><input type="text" name="email" id="email" title="이메일" value="${article.email}" size="100" maxlength="200" /></td>
</tr>
<tr>
<th>기존비밀번호</th>
<td><input type="text" name="encArticlePassword" id="encArticlePassword" title="제목" value="${encArticlePassword}" size="100" maxlength="200" readonly /></td>
</tr>
<tr>
<th>비밀번호</th>
<td><input type="text" name="articlePassword" id="articlePassword" title="비밀번호" value="${article.articlePassword}" size="100" maxlength="200" /></td>
</tr>
<tr>
<th>질문내용</th>
<td><textarea name="contentQeust" id="contentQeust" cols="80" rows="10">${article.contentQeust}</textarea></td>
</tr>
</table>
<br/>
<button name="btnNew" id="btnNew" title="취소버튼" class="float"
onclick="fn_viewDetail('${articleNo}')">취소</button>
<button type="submit" name="btnNew" id="btnNew" title="저장버튼" class="float"
onsubmit="fn_update()">저장</button>
</form>
</body> </body>
</html> </html>

View File

@ -156,6 +156,7 @@ button {
} }
.table_content table, th, td { .table_content table, th, td {
border: 1px solid #444444; border: 1px solid #444444;
line-height: 30px;
} }
@ -202,3 +203,16 @@ button {
width: 100%; width: 100%;
height: 0px; height: 0px;
} }
input {
line-height: 25px;
}
input:read-only {
background-color: #eee !important;
}
th {
background-color: #eef !important;
}

View File

@ -8,17 +8,20 @@
// 팝업으로 비밀번호를 입력받아서 콜백함수에 전달한다. // 팝업으로 비밀번호를 입력받아서 콜백함수에 전달한다.
function fn_promptPassword(msg, callbackFucName) { function fn_promptPassword(msg, placeholder, callbackFucName) {
var thePrompt = window.open("", "_NLIB_POMPT_PASSWORD", "widht=100, height=100"); var options = "top=200, left=200, width=300, height=200, status=no, menubar=no, toolbar=yes, resizable=no";
var theHTML = ""; var thePrompt = window.open("", "_NLIB_POMPT_PASSWORD", options);
var theHTML = "<html><head><title>" + placeholder + "</title><style type='text/css'> body { background-color: #ffd; } button { margin: 10px; }</style></head><body>";
theHTML += "<p>" + msg + "</p>"; theHTML += "<p>" + msg + "</p>";
theHTML += "<br/>"; theHTML += "<br/>";
theHTML += "비밀번호: <input type='text' id='thePass' placeholder='Enter Password...'/>"; theHTML += "비밀번호: <input type='text' id='thePass' placeholder='" + placeholder + "'/>";
theHTML += "<br />"; theHTML += "&nbsp;<br />";
theHTML += "<input type='button' value='확인' id='thePromptOk' onclick='opener.parent." + callbackFucName + "(" theHTML += "&nbsp;<br />";
+ "document.getElementById(\"thePass\").value); window.close();'/>"; theHTML += "<button title='확인' id='thePromptOk' onclick='opener.parent." + callbackFucName + "("
theHTML += "<input type='button' value='취소' id='thePromptClose' onclick='window.close();'/>"; + "document.getElementById(\"thePass\").value); window.close();'>확인</button>";
theHTML += "<button title='취소' id='thePromptClose' onclick='window.close();'>취소</button>";
theHTML += "</body></html>";
thePrompt.document.body.innerHTML = theHTML; thePrompt.document.body.innerHTML = theHTML;
} }