최종 코드 업데이트

This commit is contained in:
USER
2026-08-14 19:21:08 +09:00
committed by USER
parent 529de50dab
commit cd2ec1c411
19 changed files with 1463 additions and 0 deletions
@@ -0,0 +1,94 @@
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ include file ="/WEB-INF/include/include-header.jspf" %>
</head>
<body>
<h2>게시판 목록</h2>
<table class="board_list">
<colgroup>
<col width="10%"/>
<col width="50"/>
</colgroup>
<thead>
<tr>
<th scope="col">글번호</th>
<th scope="col">제목</th>
</tr>
</thead>
<tbody>
<c:choose>
<c:when test="${fn:length(list) > 0}"> <!-- boolean -->
<c:forEach items="${list }" var="row" varStatus="status">
<tr>
<td>${row.IDX }</td>
<td class="title">
<a href="#this" name="title">${row.TITLE }</a>
<input type="hidden" id="IDX" value="${row.IDX }">
</td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr>
<td colspan="4">조회된 결과가 없습니다.</td>
</tr>
</c:otherwise>
</c:choose>
</tbody>
</table>
<c:if test="${not empty paginationInfo }">
<ui:pagination paginationInfo = "${paginationInfo }" type="text" jsFunction="fn_search"/>
</c:if>
<input type="hidden" id="currentPageNo" name="currentPageNo"/>
<br/>
<a href="#this" class="btn" id="write">글쓰기</a>
<%@ include file="/WEB-INF/include/include-body.jspf" %>
<script type="text/javascript">
$(document).ready(function(){
$("#write").on("click", function(e){ //글쓰기 버튼
e.preventDefault();
fn_openBoardWrite();
});
$("a[name='title']").on("click", function(e){ //제목
e.preventDefault();
fn_openBoardDetail($(this)); //$(this)의미 : jQuery <a 태그의미
});
});
function fn_openBoardWrite(){
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardWrite.do' />");
comSubmit.submit();
}
function fn_openBoardDetail(obj){
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardDetail.do' />");
comSubmit.addParam("IDX", obj.parent().find("#IDX").val()); // key와 value값
comSubmit.submit();
}
function fn_search(pageNo)
{
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardList.do'/>");
comSubmit.addParam("currentPageNo", pageNo);
comSubmit.submit();
}
</script>
</body>
</html>
@@ -0,0 +1,24 @@
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<script src="http://ajax.googleapis.com/ajax/libs/1/jquery.min.js"></script>
<script>
$(document).ready(function(){
var name = $('#name');
var greeting = $('#greeting');
name.bind('keydown', function(){
setTimeout(greeting.text('HELLO,' + name.val() + '!!!'),0);
});
});
</script>
<title>Insert title here</title>
</head>
<body>
<input id="name" value=""/>
<p id="greeting"></p>
</body>
</html>
@@ -0,0 +1,103 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%@ include file="/WEB-INF/include/include-header.jspf" %>
</head>
<body>
<table class="board_view">
<colgroup>
<col width="15%"/>
<col width="35%"/>
<col width="15%"/>
<col width="35%"/>
</colgroup>
<caption>게시글 상세</caption>
<tbody>
<tr>
<th scope="row">글 번호</th>
<td>${map.IDX }</td>
<th scope="row">조회수</th>
<td>${map.HIT_CNT }</td>
</tr>
<tr>
<th scope="row">작성자</th>
<td>${map.CREA_ID }</td>
<th scope="row">작성시간</th>
<td>${map.CREA_DTM }</td>
</tr>
<tr>
<th scope="row">제목</th>
<td colspan="3">${map.TITLE }</td>
</tr>
<tr>
<td colspan="4">${map.CONTENTS }</td>
</tr>
<tr>
<th scope="row">첨부파일</th>
<td colspan="3">
<c:choose>
<c:when test="${fn:length(list) >0 }"> <!-- boolean -->
<c:forEach var="row" items="${list}">
<input type="hidden" id="IDX" value="${row.IDX }">
<a href="#this" name="file">${row.ORIGINAL_FILE_NAME }</a>
(${row.FILE_SIZE }kb)
</c:forEach>
</c:when>
<c:otherwise>첨부된 파일이 없습니다.!</c:otherwise>
</c:choose>
</td>
</tr>
</tbody>
</table>
<a href="#this" class="btn" id="list">목록으로</a>
<a href="#this" class="btn" id="update">수정하기</a>
<%@ include file="/WEB-INF/include/include-body.jspf" %>
<script type="text/javascript">
$(document).ready(function(){
$("#list").on("click", function(e){ //목록으로 버튼
e.preventDefault();
fn_openBoardList();
});
$("#update").on("click", function(e){ //수정하기 버튼
e.preventDefault();
fn_openBoardUpdate();
});
$("a[name='file']").on("click", function(e){ //파일이름
e.preventDefault();
fn_downloadFile($(this));
});
});
function fn_openBoardList(){
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardList.do' />");
comSubmit.submit();
}
function fn_openBoardUpdate(){
var idx = "${map.IDX}";
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardUpdate.do' />");
comSubmit.addParam("IDX", idx);
comSubmit.submit();
}
function fn_downloadFile(obj)
{
var idx = obj.parent().find("#IDX").val();
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/common/downloadFile.do'/>");
comSubmit.addParam("IDX", idx);
comSubmit.submit();
}
</script>
</body>
</html>
@@ -0,0 +1,98 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%@ include file ="/WEB-INF/include/include-header.jspf" %>
</head>
<body>
<h2>게시판 목록</h2>
<table class="board_list">
<colgroup>
<col width="10%"/>
<col width="*"/>
<col width="15%"/>
<col width="20%"/>
</colgroup>
<thead>
<tr>
<th scope="col">글번호</th>
<th scope="col">제목</th>
<th scope="col">조회수</th>
<th scope="col">작성일</th>
</tr>
</thead>
<tbody>
<c:choose>
<c:when test="${fn:length(list) > 0}"> <!-- boolean -->
<c:forEach items="${list }" var="row" varStatus="status">
<tr>
<td>${row.IDX }</td>
<td class="title">
<a href="#this" name="title">${row.TITLE }</a>
<input type="hidden" id="IDX" value="${row.IDX }">
</td>
<td>${row.HIT_CNT }</td>
<td>${row.CREA_DTM }</td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr>
<td colspan="4">조회된 결과가 없습니다.</td>
</tr>
</c:otherwise>
</c:choose>
</tbody>
</table>
<c:if test="${not empty paginationInfo }">
<ui:pagination paginationInfo = "${paginationInfo }" type="text" jsFunction="fn_search"/>
</c:if>
<input type="hidden" id="currentPageNo" name="currentPageNo"/>
<br/>
<a href="#this" class="btn" id="write">글쓰기</a>
<%@ include file="/WEB-INF/include/include-body.jspf" %>
<script type="text/javascript">
$(document).ready(function(){
$("#write").on("click", function(e){ //글쓰기 버튼
e.preventDefault();
fn_openBoardWrite();
});
$("a[name='title']").on("click", function(e){ //제목
e.preventDefault();
fn_openBoardDetail($(this)); //$(this)의미 : jQuery <a 태그의미
});
});
function fn_openBoardWrite(){
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardWrite.do' />");
comSubmit.submit();
}
function fn_openBoardDetail(obj){
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardDetail.do' />");
comSubmit.addParam("IDX", obj.parent().find("#IDX").val()); // key와 value값
comSubmit.submit();
}
function fn_search(pageNo)
{
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardList.do'/>");
comSubmit.addParam("currentPageNo", pageNo);
comSubmit.submit();
}
</script>
</body>
</html>
@@ -0,0 +1,13 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Insert title here</title>
<%@ include file="/WEB-INF/include/include-header.jspf" %>
</head>
<body>
HI~
<%@ include file="/WEB-INF/include/include-body.jspf" %>
</body>
</html>
@@ -0,0 +1,164 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%@ include file="/WEB-INF/include/include-header.jspf" %>
</head>
<body>
<form id="frm" name="frm" enctype="multipart/form-data">
<table class="board_view">
<colgroup>
<col width="15%"/>
<col width="35%"/>
<col width="15%"/>
<col width="35%"/>
</colgroup>
<caption>게시글 상세</caption>
<tbody>
<tr>
<th scope="row">글 번호</th>
<td>
${map.IDX }
<input type="hidden" id="IDX" name="IDX" value="${map.IDX }">
</td>
<th scope="row">조회수</th>
<td>${map.HIT_CNT }</td>
</tr>
<tr>
<th scope="row">작성자</th>
<td>${map.CREA_ID }</td>
<th scope="row">작성시간</th>
<td>${map.CREA_DTM }</td>
</tr>
<tr>
<th scope="row">제목</th>
<td colspan="3">
<input type="text" id="TITLE" name="TITLE" class="wdp_90" value="${map.TITLE }">
</td>
</tr>
<tr>
<td colspan="4" class="view_text">
<textarea rows="20" cols="100" title="내용" id="CONTENTS" name="CONTENTS">${map.CONTENTS }</textarea>
</td>
</tr>
<tr>
<th scope="row">첨부파일</th>
<td colspan="3">
<div id="fileDiv">
<c:choose>
<c:when test="${fn:length(list)>0 }">
<c:forEach var="row" items="${list }" varStatus="var">
<p>
<input type="hidden" id="IDX" name="IDX_${var.index }" value="${row.IDX }">
<a href="#this" id="name_${var.index }" name="name_${var.index }">${row.ORIGINAL_FILE_NAME }</a>
<input type="file" id="file_${var.index }" name="file_${var.index }">
(${row.FILE_SIZE }kb)
<a href="#this" class="btn" id="delete_${var.index }" name="delete_${var.index }">삭제</a>
</p>
</c:forEach>
</c:when>
<c:otherwise>첨부된 파일이 없습니다!</c:otherwise>
</c:choose>
</div>
</td>
</tr>
</tbody>
</table>
</form>
<a href="#this" class="btn" id="addFile">파일추가</a>
<a href="#this" class="btn" id="list">목록으로</a>
<a href="#this" class="btn" id="update">저장하기</a>
<a href="#this" class="btn" id="delete">삭제하기</a>
<%@ include file="/WEB-INF/include/include-body.jspf" %>
<script type="text/javascript">
var gfv_count = "${fn:length(list)+1}";
$(document).ready(function(){
$("#list").on("click",function(e){
e.preventDefault();
fn_openBoardList();
});
$("#update").on("click",function(e){
e.preventDefault();
fn_updateBoard();
});
$("#delete").on("click",function(e){
e.preventDefault();
fn_deleteBoard();
});
$("#addFile").on("click", function(e){ //파일 추가
e.preventDefault();
fn_addFile();
});
$("a[name^='delete']").on("click", function(e){
e.preventDefault();
fn_deleteFile($(this));
});
});
function fn_openBoardList()
{
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardList.do'/>");
comSubmit.submit();
}
function fn_updateBoard()
{
var comSubmit = new ComSubmit("frm");
comSubmit.setUrl("<c:url value='/sample/updateBoard.do'/>");
comSubmit.submit();
}
function fn_deleteBoard()
{
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/deleteBoard.do'/>");
comSubmit.addParam("IDX",$("#IDX").val());
comSubmit.submit();
}
function fn_addFile()
{
var str = "<p><input type='file' id='file_"+(gfv_count)+"' name='file_"+(gfv_count)+"'>"+
"<a href='#this' class='btn' id='delete_"+(gfv_count)+"' name='delete_"+(gfv_count)+"'>삭제</a></p>";
$("#fileDiv").append(str);
$("#delete_"+(gfv_count++)).on("click", function(e){
e.preventDefault();
fn_deleteFile($(this));
});
}
//boardWrite.jsp 와 비교
/* function fn_addFile(){
var str = "<p><input type='file' name='file_"+(gfv_count++)+"'><a href='#this' class='btn' name='delete'>삭제</a></p>";
$("#fileDiv").append(str);
$("a[name='delete']").on("click", function(e){ //삭제 버튼
e.preventDefault();
fn_deleteFile($(this));
});
} */
function fn_deleteFile(obj)
{
obj.parent().remove();
}
</script>
</body>
</html>
@@ -0,0 +1,97 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ko">
<head>
<%@ include file="/WEB-INF/include/include-header.jspf" %>
<title>Insert title here</title>
</head>
<body>
<form id="frm" name="frm" enctype="multipart/form-data">
<table class="board_view">
<colgroup>
<col width="15%">
<col width="*"/>
</colgroup>
<caption>게시글 작성</caption>
<tbody>
<tr>
<th scope="row">제목</th>
<td><input type="text" id="TITLE" name="TITLE" class="wdp_90"></input></td>
</tr>
<tr>
<td colspan="2" class="view_text">
<textarea rows="20" cols="80" title="내용" id="CONTENTS" name="CONTENTS"></textarea>
</td>
</tr>
</tbody>
</table>
<!-- <input type="file" name="file"><br/><br/> -->
<div id="fileDiv">
<p>
<input type="file" id="file" name="file_0">
<a href="#this" class="btn" id="delete" name="delete">삭제</a>
</p>
</div>
<br/><br/>
<a href="#this" class="btn" id="addFile">파일추가</a>
<a href="#this" class="btn" id="write">작성하기</a>
<a href="#this" class="btn" id="list">목록으로</a>
</form>
<%@ include file="/WEB-INF/include/include-body.jspf" %>
<script type="text/javascript">
var gfv_count = 1;
$(document).ready(function(){
$("#list").on("click", function(e){ //목록으로 버튼
e.preventDefault();
fn_openBoardList();
});
$("#write").on("click", function(e){ //작성하기 버튼
e.preventDefault();
fn_insertBoard();
});
$("#addFile").on("click", function(e){ //파일추가하기
e.preventDefault();
fn_addFile();
});
$("a[name='delete']").on("click", function(e){ //추가한 파일 삭제하기
e.prevnetDefault();
fn_deleteFile($(this));
});
});
function fn_openBoardList(){
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardList.do' />");
comSubmit.submit();
}
function fn_insertBoard(){
var comSubmit = new ComSubmit("frm");
comSubmit.setUrl("<c:url value='/sample/insertBoard.do' />");
comSubmit.submit();
}
function fn_addFile(){
var str = "<p><input type='file' name='file_"+(gfv_count++)+"'><a href='#this' class='btn' name='delete'>삭제</a></p>";
$("#fileDiv").append(str);
$("a[name='delete']").on("click", function(e){ //삭제 버튼
e.preventDefault();
fn_deleteFile($(this));
});
}
function fn_deleteFile(obj)
{
obj.parent().remove(); //<p>태그 삭제
}
</script>
</body>
</html>
+12
View File
@@ -0,0 +1,12 @@
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
kkkk
</body>
</html>