<%@page import="Dto.QADto"%>
<%@page import="java.util.*"%>
<%@page import="Dao.QADao"%>
<%@page import="Dto.MemberDto"%>
<%
String findword = request.getParameter("findword");
%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<jsp:include page="Header.jsp"></jsp:include>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!-- 글쓰기 버튼 -->
<link
href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:700'
rel='stylesheet' type='text/css'>
<!-- bootstrapk table 링크 -->
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous">
<!-- 검색창 밑 backgraund_img.css -->
<link href="<%=request.getContextPath()%>/CSS/QAList.css" rel="stylesheet">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>QA List</title>
</head>
<body>
<!-- 댓글!! -->
<%! public String arrow(int depth) {
String rs = "<img src='img/arrow.png' width='20px' height='20px'/>";
String nbsp = " "; // depth의 간격
String ts = "";
for (int i = 0; i < depth; i++) {
ts += nbsp;
}
return depth == 0 ? "" : ts + rs;
} %>
<!-- mamber Session -->
<% MemberDto mem = (MemberDto) session.getAttribute("kh_member");
boolean idcheck = true;
if (mem == null) {
idcheck = false;
}
QADao dao = QADao.getInstance();
List<QADto> QAlist = (List<QADto>) request.getAttribute("list");
//Page페이징
String totalstr = (String) request.getAttribute("count");
int total = 0;
String currstr = (String) request.getAttribute("currentPage");
int curr = 0;
String searchmode = (String) request.getAttribute("search");
String searchstr = (String) request.getAttribute("str");
int searchint = 0;
if (searchmode != null) {
searchint = Integer.parseInt(searchmode);
}
if (totalstr != null) {
total = Integer.parseInt(totalstr);
}
if (currstr != null) {
curr = Integer.parseInt(currstr);
}
int pagenums = 0;
//page 번호
if (total % 10 == 0) {
pagenums = total / 10;
} else {
pagenums = total / 10 + 1;
}
int[] pagenumbers = new int[9];
boolean dotbefore = true;
boolean dotafter = true;
if (pagenums <= 9) {
dotbefore = false;
dotafter = false;
for (int i = 0; i < pagenums; i++) {
pagenumbers[i] = i + 1;
}
} else if (curr - 1 <= 4) {
// 1234 56789
for (int i = 0; i < 9; i++) {
pagenumbers[i] = i + 1;
}
dotbefore = false;
} else if (pagenums - curr <= 4) {
// .. 34 56789 10 11 12
int j = 8;
for (int i = 0; i < 9; i++) {
pagenumbers[i] = pagenums - j;
j--;
}
dotafter = false;
} else {
int j = -4;
for (int i = 0; i < 9; i++) {
pagenumbers[i] = curr + j;
j++;
}
}%>
<!-- 최상단 이미지 부분 -->
<div class="img">
<div class="content">
<!-- 검색 -->
<div class="inner_MAIN">
<div class="search_form">
<div class="botton_main">
<!-- butt -->
<fieldset>
<div class="inner_SUB">
<select class="search_Group" id="searchbox" name="searchbox">
<option value="0">전체보기</option>
<option value="1">작성자</option>
<option value="2">제목</option>
<option value="3">내용</option>
</select> <input type="text" class="text_1" id="search" name="search"
maxlength="20" style="margin: -27px;">
<div class="button-row">
<div>
<a id="searchQA" name="searchQA" onclick="searchQA()"
title="검색"> </a>
</div>
</div>
</div>
</div>
</fieldset>
</div>
</div>
</div>
<!-- img_위에 망 덮어씌움 이유 : 이미지가 색이 강력크 .. ㅋㅌ 방지용 -->
<div class="img-cover"></div>
</div>
<div style="width: 1020px; margin: 50px auto 30px; text-align: center;">
<h2 style="font-size: 1.5em; font-weight: 680;">Q&A 게시판</h2>
</div>
<!-- 게시판 table -->
<div style="min-height: 220px" align="center">
<table style="width: 1100px;" class="table">
<col width="100">
<col width="200">
<col width="300">
<col width="100">
<col width="150">
<col width="60">
<thead>
<tr>
<th scope="col">번호</th>
<th scope="col">제목</th>
<th scope="col">내용</th>
<th scope="col">작성자</th>
<th scope="col">날자</th>
<th scope="col">조회수</th>
</tr>
</thead>
<% /* List 사이즈 정의 */
if (QAlist == null || QAlist.size() == 0) {
%>
<tr>
<td colspan="3">작성된 글이 없습니다</td>
</tr>
<%
} else {
int Articlenumber = 0; //글번호(삭제,글 나타나기 선언 객체)
/* List 뿌려주기 */
for (int i = 0; i < QAlist.size(); i++) {
QADto QAbbs = QAlist.get(i);
//삭제
if (QAbbs.getDel() == 0) {
Articlenumber++;
%>
<tr>
<td><%=QAbbs.getRownum()%></td>
<td><a style="text-decoration: none;" href="./JSP/QADetail.jsp?seq=<%=QAbbs.getSeq()%>"> <%=QAbbs.getTitle()%> </a>
re:<%=QAbbs.getStep() %></td>
<td><%=QAbbs.getContent()%></td>
<td><%=QAbbs.getId()%></td>
<td><%=QAbbs.getWdate()%></td>
<td><%=QAbbs.getReadcount()%></td>
</tr>
<%
}
}
}
%>
</table>
</div>
<!-- 글쓰기 버튼 -->
<div align="center">
<div class="border_Button" onclick="QAwrite()">
<p style="text-decoration: none;" href="#">글쓰기</p>
</div>
</div>
<!-- Page페이징 글자 표기 view -->
<div style="text-align: center;">
<%
String link = "";
if (searchint == 0) {
link = request.getContextPath() + "/QAController?command=list&searchfor=0&pageNum=";
} else if (searchint == 1) {
link = request.getContextPath() + "/QAController?command=list&searchfor=1&findword=" + searchstr
+ "&pageNum=";
} else if (searchint == 2) {
link = request.getContextPath() + "/QAController?command=list&searchfor=2&findword=" + searchstr
+ "&pageNum=";
} else if (searchint == 3) {
link = request.getContextPath() + "/QAController?command=list&searchfor=3&findword=" + searchstr
+ "&pageNum=";
}
%>
<img id="pageimg" style="min-width: 40px" src="./img/Page_left-arrow_1.png" alt="이미지없음"
class="btn" onclick="location='<%=link%>1'">
<c:if test="<%=dotbefore%>">..</c:if>
<%
for (int i = 0; i < 9; i++) {
if (pagenumbers[i] != 0) {
if (pagenumbers[i] == curr) {
%>
<button class="btns mainbut_page" style="borderStyle: inset; color: pink" disabled="disabled"><%=pagenumbers[i]%></button>
<%-- <font color="red"><%=pagenumbers[i]%></font> --%>
<%
} else {
%>
<button class="btns mainbut_page" onclick="location='<%=link%><%=pagenumbers[i]%>'"><%=pagenumbers[i]%></button>
<%-- <a href="<%=link%><%=pagenumbers[i]%>"> <%=pagenumbers[i]%></a> --%>
<%
}
}
}
%>
<c:if test="<%=dotafter%>">..</c:if>
<img id="pageimg" style="min-width: 40px" src="./img/Page_Right-arrow_1.png" alt="이미지없음"
class="btn" onclick="location='<%=link%><%=pagenums%>'">
</div>
<br>
<!-- 검색 -->
<script type="text/javascript">
function searchQA() {
var sel = document.getElementById("searchbox");
var searchfor = sel.options[sel.selectedIndex].value;
var msg = document.getElementById("search").value;
location.href = "./QAController?command=list&searchfor="+searchfor + "&findword=" + msg ;
}
//글쓰기
function QAwrite() {
var idcheck = <%=idcheck%>; // 아이디값 불러옴
if (idcheck){
location = "<%=request.getContextPath()%>/JSP/QAwrite.jsp";
}else{
alert('로그인을 해주세요.');
return;
}
}
</script>
<!-- Footer -->
<jsp:include page="Footer.jsp"></jsp:include>
</body>
</html>
<%@page import="Dto.MemberDto"%>
<%@ 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=EUC-KR">
<link href="<%=request.getContextPath()%>/CSS/Table.css" rel="stylesheet">
<title>QAwrite</title>
</head>
<body>
<%
Object ologin = session.getAttribute("kh_member");
MemberDto mem = null;
mem = (MemberDto) ologin;
%>
<jsp:include page="Header.jsp"></jsp:include>
<!-- 최상단 이미지 부분 -->
<div class="img">
<!-- img_위에 망 덮어씌움 이유 : 이미지가 색이 강력크 .. ㅋㅌ 방지용 -->
<div class="img-cover"></div>
</div>
<div class="outer-container">
<div style="width: 1020px; margin: 50px auto 30px; text-align: center;">
<h2 style="font-size: 1.5em; font-weight: 680;">Q&A write</h2>
</div>
<br>
<form
action="<%=request.getContextPath()%>/QAController?command=regist_add"
method="post">
<div class="inner-container">
<table border="0" style="border-collapse: collapse">
<col width="100">
<col width="920">
<tr>
<td>이름</td>
<td><input type="text" class="input_data" name="id" readonly
value="<%=mem.getId()%>" style="padding-left: 2px; border: 0; "></td>
</tr>
<tr>
<td>제목</td>
<td><input type="text" class="input_data" name="title"
placeholder="제목을 입력하세요. " required id="title"
style="width: 170px;"></td>
</tr>
<tr style="border-bottom: 0;">
<td style="vertical-align: top; padding-top: 8px;">내용</td>
<td style="padding-top: 8px;"><textarea class="input_data"
id="content" name="content" rows="4" cols="50"
placeholder="내용을 입력하세요." required
style="width: 90%; height: 500px;"></textarea></td>
</tr>
</table>
</div>
<div align="center">
<tr>
<td colspan="2"><input type="submit" value="등록" class="mainbut" />
<input type="button" value="글 목록 " class="mainbut"
onclick="javascript:location.href='<%=request.getContextPath()%>/QAController?command=list&searchfor=0'" />
</td>
</tr>
</div>
</form>
</div>
<!-- Footer -->
<jsp:include page="Footer.jsp"></jsp:include>
</body>
</html>
<%@page import="Dto.MemberDto"%>
<%@page import="Dto.PdsDto"%>
<%@page import="Dao.PdsDao"%>
<%@ 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">
<link href="<%=request.getContextPath()%>/CSS/Table.css" rel="stylesheet">
<title>Pdsdetail</title>
</head>
<body>
<%
MemberDto mdo =(MemberDto) session.getAttribute("kh_member");
boolean idcheck = false;
String idstr = "";
if(mdo != null){
idcheck = true;
idstr = mdo.getId();
}
String wk =request.getParameter("seq");
int pdsid=Integer.parseInt(wk);
PdsDao dao = PdsDao.getInstance();
dao.pdsReadCount(pdsid);
PdsDto dto =dao.getPDS(pdsid);
%>
<jsp:include page="../JSP/Header.jsp"></jsp:include>
<!-- 최상단 이미지 부분 -->
<div class="img">
<!-- img_위에 망 덮어씌움 이유 : 이미지가 색이 강력크 .. ㅋㅌ 방지용 -->
<div class="img-cover"></div>
</div>
<div style="width: 1020px; margin: 50px auto 30px; text-align: center;">
<h2 style="font-size: 1.5em; font-weight: 680;"> Pdsdetail </h2>
</div>
<div class="outer-container">
<form action="../PdsController?command=detailPds" method="post">
<div class="inner-container">
<table border="0" style="border-collapse: collapse;">
<col width="100">
<col width="920">
<tr>
<td>작성자</td>
<td style="text-align: left; padding-left: 10px;"><%=dto.getId() %></td>
</tr>
<tr>
<td>제목</td>
<td style="text-align: left; padding-left: 10px;"><%=dto.getTitle() %></td>
</tr>
<tr>
<td>작성일</td>
<td style="text-align: left; padding-left: 10px;"><%=dto.getRegdate() %></td>
</tr>
<tr>
<td>다운로드</td>
<td><input type="button" id="btndown" name="btndown" value="<%=dto.getFilename() %>" style="float: left; margin-left: 10px;"
onclick="filedown()"></td>
</tr>
<tr style="border-bottom: 0;">
<td style="vertical-align: top; padding-top: 8px;">내용</td>
<td><textarea class="input_data" name="content" style="width: 90%; height: 500px; outline: none" readonly="readonly"><%=dto.getContent() %></textarea></td>
</tr>
</table>
</div>
</form>
<form action="<%=request.getContextPath()%>/PdsController" method="post">
<input type="hidden" name="command" value="delete">
<input type="hidden" name="seq" value="<%=dto.getSeq()%>">
<input class="mainbut" id="delete" type="submit" value="삭제">
<button class="mainbut" id="update" type="button" onclick="location.href = '<%=request.getContextPath()%>/JSP/Pdsupdate.jsp?seq=<%=dto.getSeq()%>'" >수정하기</button>
</form>
</div>
<jsp:include page="../JSP/Footer.jsp"></jsp:include>
<script>
var del = document.getElementById("delete");
var up = document.getElementById("update");
var down = document.getElementById("btndown");
if(<%=!idcheck %> || '<%=idstr %>' !== '<%=dto.getId()%>'){
del.setAttribute("disabled", "disabled");
up.setAttribute("disabled", "disabled");
}
function filedown(){
if(<%=!idcheck %> || '<%=idstr %>' !== '<%=dto.getId()%>'){
alert("로그인하셔야 다운로드 가능합니다.");
}else{
location='<%=request.getContextPath() %>/PdsController?command=download&filename=<%=dto.getFilename()%>&seq=<%=dto.getSeq()%>'
}
}
</script>
</body>
</html>
<%@page import="Dto.PdsDto"%>
<%@page import="Dao.PdsDao"%>
<%@ 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>Pdsupdate</title>
<link href="<%=request.getContextPath()%>/CSS/Table.css" rel="stylesheet">
</head>
<body>
<%
String wk =request.getParameter("seq");
int pdsid=Integer.parseInt(wk);
PdsDao dao = PdsDao.getInstance();
PdsDto dto =dao.getPDS(pdsid);
%>
<jsp:include page="../JSP/Header.jsp"></jsp:include>
<!-- 최상단 이미지 부분 -->
<div class="img">
<!-- img_위에 망 덮어씌움 이유 : 이미지가 색이 강력크 .. ㅋㅌ 방지용 -->
<div class="img-cover"></div>
</div>
<div style="width: 1020px; margin: 50px auto 30px; text-align: center;">
<h2 style="font-size: 1.5em; font-weight: 680;"> Pdsupdate </h2>
</div>
<div class="outer-container" style="margin-bottom: 80px;">
<form action="<%=request.getContextPath() %>/PdsController" method="post">
<input type="hidden" name="seq" value="<%=pdsid %>">
<input type="hidden" name="command" value="update">
<div class="inner-container">
<table border="0" style="border-collapse: collapse;">
<col width="100">
<col width="920">
<tr>
<td>작성자</td>
<td><input type="text" class="input_data" name="id" value="<%=dto.getId() %>" style="border: 0;" readonly></td>
</tr>
<tr>
<td>작성일</td>
<td><input type="text" class="input_data" name="wdate" value="<%=dto.getRegdate() %>" style="border: 0;" readonly></td>
</tr>
<tr>
<td>제목</td>
<td><input type="text" class="input_data" name="title" value="<%=dto.getTitle() %>"></td>
</tr>
<tr style="border-bottom: 0;">
<td style="vertical-align: top; padding-top: 8px;">내용</td>
<td style="padding-top: 8px;"><textarea class="input_data" id="content" name="content"
style="width: 90%; height: 500px;" placeholder="내용을 입력하세요."><%=dto.getContent() %></textarea></td>
</tr>
</table>
</div>
<input class="mainbut" type="submit" value="수정하기">
</form>
</div>
<jsp:include page="../JSP/Footer.jsp"></jsp:include>
</body>
</html>
*댓글
<%@page import="Dto.MemberDto"%>
<%@page import="Dto.QADto"%>
<%@page import="Dao.QADao"%>
<%@ 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>QAanswer</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp"
crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript-->
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<%
String sseq = request.getParameter("seq");
int seq = Integer.parseInt(sseq.trim());
QADao dao = QADao.getInstance();
dao.QAreadcount(seq);
QADto dto = dao.getBbs(seq);
%>
</head>
<body>
<div align="center">
<a href="login.jsp">로그아웃</a>
<h1>원글 보기</h1>
</div>
<div class="center">
<table class="table table-bordered" style="width: 700px"
height="500px" align="center">
<col width="100px">
<tr>
<td>ID:</td>
<td><%=dto.getId()%>"></td>
</tr>
<tr>
<td>제목:</td>
<td><%=dto.getTitle()%>"></td>
</tr>
<tr>
<td>작성일:</td>
<td><%=dto.getWdate()%>"></td>
</tr>
<tr>
<td>조회수:</td>
<td><%=dto.getReadcount()%>"></td>
</tr>
<tr>
<td>정보</td>
<td><%=dto.getRef()%>-<%=dto.getStep()%>-<%=dto.getDepth()%></td>
</tr>
<tr>
<td>내용</td>
<td><textarea cols="700" name="content" readonly="readonly"
class="form-control"> <%=dto.getContent()%> </textarea></td>
</tr>
</table>
</div>
<hr>
<%
Object ologin = session.getAttribute("kh_member");
MemberDto mem = (MemberDto) ologin;
%>
<div align="center">
<h1>답글달기</h1>
</div>
<div class="center">
<form action="../QAController?command=QAanswer" method="post">
<input type="hidden" name="seq" value=<%=seq%>>
<table class="table table-bordered" style="width: 700px"
height="500px" align="center">
<col width="100px">
<tr>
<td>ID:</td>
<td><input type="text" name="id" class="form-control"
value="<%=mem.getId()%>"></td>
</tr>
<tr>
<td>제목:</td>
<td><input type="text" name="title" placeholderclass="title" "form-control"></td>
</tr>
<tr>
<td>내용</td>
<td><textarea cols="700" placeholder="내용을 입력하세요. "
name="content" class="form-control"></textarea></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="답글"></td>
</tr>
</table>
</form>
</div>
</body>
</html>
'JavaScript mini Project > Project java code ' 카테고리의 다른 글
Mem,Pbs,QA,Reserve - Controller (MVC2) (0) | 2018.09.30 |
---|---|
Location (0) | 2018.09.26 |
About (0) | 2018.09.26 |
자료올리기 (0) | 2018.09.26 |
상담신청 (0) | 2018.09.26 |