안효원 안효원 2021-08-31
JSP_Board 99%
@742d77099b81f17550c801f59d2c22b364e758f2
 
.classpath (added)
+++ .classpath
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v9.0">
+		<attributes>
+			<attribute name="owner.project.facets" value="jst.web"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="test" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
 
.project (added)
+++ .project
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>JSP_Board</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.common.project.facet.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.validation.validationbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+	</natures>
+</projectDescription>
 
.settings/.jsdtscope (added)
+++ .settings/.jsdtscope
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="src/main/webapp"/>
+	<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
+		<attributes>
+			<attribute name="hide" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+	<classpathentry kind="output" path=""/>
+</classpath>
 
.settings/org.eclipse.core.resources.prefs (added)
+++ .settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+encoding//src/main/java/config/EncodingFiter.java=UTF-8
+encoding//src/main/java/control/MemberServlet.java=UTF-8
 
.settings/org.eclipse.jdt.core.prefs (added)
+++ .settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
 
.settings/org.eclipse.m2e.core.prefs (added)
+++ .settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
 
.settings/org.eclipse.wst.common.component (added)
+++ .settings/org.eclipse.wst.common.component
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
+    <wb-module deploy-name="WebTest-0.0.1-SNAPSHOT">
+        <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
+        <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
+        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
+        <property name="java-output-path" value="/JSP_Board/build/classes"/>
+        <property name="context-root" value="WebTest"/>
+    </wb-module>
+</project-modules>
 
.settings/org.eclipse.wst.common.project.facet.core.xml (added)
+++ .settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+  <runtime name="Apache Tomcat v9.0"/>
+  <fixed facet="jst.web"/>
+  <fixed facet="wst.jsdt.web"/>
+  <fixed facet="java"/>
+  <installed facet="jst.web" version="3.1"/>
+  <installed facet="wst.jsdt.web" version="1.0"/>
+  <installed facet="java" version="1.8"/>
+</faceted-project>
 
.settings/org.eclipse.wst.jsdt.ui.superType.container (added)
+++ .settings/org.eclipse.wst.jsdt.ui.superType.container
@@ -0,0 +1,1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary(No newline at end of file)
 
.settings/org.eclipse.wst.jsdt.ui.superType.name (added)
+++ .settings/org.eclipse.wst.jsdt.ui.superType.name
@@ -0,0 +1,1 @@
+Window(No newline at end of file)
 
.settings/org.eclipse.wst.validation.prefs (added)
+++ .settings/org.eclipse.wst.validation.prefs
@@ -0,0 +1,2 @@
+disabled=06target
+eclipse.preferences.version=1
 
build/classes/config/Database.class (Binary) (added)
+++ build/classes/config/Database.class
Binary file is not shown
 
build/classes/config/EncodingFiter.class (Binary) (added)
+++ build/classes/config/EncodingFiter.class
Binary file is not shown
 
build/classes/control/MemberServlet.class (Binary) (added)
+++ build/classes/control/MemberServlet.class
Binary file is not shown
 
build/classes/model/MemberDAO.class (Binary) (added)
+++ build/classes/model/MemberDAO.class
Binary file is not shown
 
build/classes/model/MemberDTO.class (Binary) (added)
+++ build/classes/model/MemberDTO.class
Binary file is not shown
 
build/classes/model/ReplyDTO.class (Binary) (added)
+++ build/classes/model/ReplyDTO.class
Binary file is not shown
 
src/main/java/config/Database.class (Binary) (added)
+++ src/main/java/config/Database.class
Binary file is not shown
 
src/main/java/config/Database.java (added)
+++ src/main/java/config/Database.java
@@ -0,0 +1,28 @@
+package config;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+
+
+public class Database
+{
+  private static String dbHost = "db.asin21.com";
+  private static String dbUser = "demo07";
+  private static String dbPass = "demo07!";
+  private static String dbName = "db_demo07";
+  
+  private static String dbDriver = "com.mysql.jdbc.Driver";
+  private static String dbUrl = "jdbc:mysql://" + dbHost + "/" + dbName + "?characterEncoding=UTF-8";
+
+  
+  public static Connection getConnection() {
+    try {
+      Class.forName(dbDriver);
+      return DriverManager.getConnection(dbUrl, dbUser, dbPass);
+    }
+    catch (Exception e) {
+      e.printStackTrace();
+      return null;
+    } 
+  }
+}
 
src/main/java/config/EncodingFiter.class (Binary) (added)
+++ src/main/java/config/EncodingFiter.class
Binary file is not shown
 
src/main/java/config/EncodingFiter.java (added)
+++ src/main/java/config/EncodingFiter.java
@@ -0,0 +1,45 @@
+package config;
+
+import java.io.IOException;
+import java.sql.Connection;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.annotation.WebFilter;
+
+@WebFilter({ "/*" })
+public class EncodingFiter implements Filter {
+	private final String charset = "utf-8";
+
+	public EncodingFiter() {
+		System.out.println("Fiter Created!");
+	}
+
+	public void destroy() {
+		System.out.println("System Down!");
+	}
+
+	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+			throws IOException, ServletException {
+		System.out.println("Servlet Auto Start Successfuly");
+
+		request.setCharacterEncoding("utf-8");
+		response.setContentType("text/html; charset=utf-8");
+		response.setCharacterEncoding("utf-8");
+
+		chain.doFilter(request, response);
+	}
+
+	public void init(FilterConfig fConfig) throws ServletException {
+		System.out.println("system Start");
+		Connection conn = Database.getConnection();
+		if (conn != null) {
+			System.out.println(conn + " : DB Connention Success!");
+		} else {
+			System.out.println("DB Connention Fail!!");
+		}
+	}
+}
 
src/main/java/control/MemberServlet.java (added)
+++ src/main/java/control/MemberServlet.java
@@ -0,0 +1,313 @@
+package control;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import model.MemberDAO;
+import model.MemberDTO;
+import model.ReplyDTO;
+
+/**
+ * Servlet implementation class MemberServlet
+ */
+@WebServlet({ "/Member/*" })
+public class MemberServlet extends HttpServlet {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * @see HttpServlet#HttpServlet()
+	 */
+	public MemberServlet() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
+	 *      response)
+	 */
+	protected void doGet(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		String url = request.getRequestURL().toString();
+		String viewPage = null;
+
+		MemberDAO dao = new MemberDAO();
+		PrintWriter out = response.getWriter();
+
+		if (url.indexOf("list.do") != -1) {
+			int pageStart;
+			String option = request.getParameter("option");
+			String searchText = request.getParameter("searchText");
+
+			String pageStart1 = request.getParameter("pageStart");
+
+			if (pageStart1 == null) {
+				pageStart = 0;
+			} else {
+				pageStart = Integer.parseInt(request.getParameter("pageStart"));
+			}
+
+			int countFor = dao.getCountFor(option, searchText);
+
+			List<MemberDTO> list = dao.MemberList(option, searchText, pageStart);
+			Map<String, Object> map = new HashMap<String, Object>();
+
+			map.put("list", list);
+			map.put("count", Integer.valueOf(list.size()));
+			request.setAttribute("map", map);
+
+			viewPage = "/view/list.jsp";
+			RequestDispatcher goUrl = request.getRequestDispatcher(viewPage);
+			goUrl.forward(request, response);
+		} else if (url.indexOf("content.do") != -1) {
+			int no = Integer.parseInt(request.getParameter("no"));
+			request.setAttribute("no", Integer.valueOf(no));
+
+			List<ReplyDTO> list2 = dao.ReplyList(no);
+			Map<String, Object> map = new HashMap<String, Object>();
+
+			map.put("list2", list2);
+			map.put("count", Integer.valueOf(list2.size()));
+			System.out.println(map);
+			request.setAttribute("map", map);
+
+			viewPage = "/view/content.jsp";
+			RequestDispatcher goUrl = request.getRequestDispatcher(viewPage);
+			goUrl.forward(request, response);
+
+			int noForCount = Integer.parseInt(request.getParameter("no"));
+			int view = Integer.parseInt(request.getParameter("view"));
+
+			dao.setCountUpdate(noForCount, view);
+
+		} else if (url.indexOf("write.do") != -1) {
+
+			viewPage = "/view/write.jsp";
+			RequestDispatcher goUrl = request.getRequestDispatcher(viewPage);
+			goUrl.forward(request, response);
+		} else if (url.indexOf("insert") != -1) {
+
+			request.setCharacterEncoding("UTF-8");
+			response.setCharacterEncoding("UTF-8");
+			response.setContentType("text/html; charset=utf-8");
+
+			String writer = request.getParameter("inputWriter");
+			if (writer.equals("")) {
+				writer = "Anonymous";
+			}
+
+			String title = request.getParameter("inputTitle");
+			String contents = request.getParameter("inputContents");
+			Date date = new Date();
+			SimpleDateFormat simpleDate = new SimpleDateFormat("yyyy-MM-dd");
+			String strdate = simpleDate.format(date);
+
+			Calendar cal = Calendar.getInstance();
+
+			int mondifyedMonth = cal.get(2) + 1;
+
+			String inputDate = String.valueOf(cal.get(1)) + "-" + mondifyedMonth + "-" + cal.get(5);
+
+			int view = 1;
+
+			boolean result = false;
+			result = dao.setInsert(writer, title, contents, view, inputDate);
+
+			if (result) {
+				out.println("<script>alert('등록 완료')</script>");
+				viewPage = "list.do";
+			} else {
+				out.println("<script>alert('등록 실패')</script>");
+				viewPage = "list.do";
+			}
+
+			out.println("<script>location.href='list.do'</script>");
+
+		} else if (url.indexOf("delete.do") != -1) {
+
+			int no = Integer.parseInt(request.getParameter("no"));
+			System.out.println(no);
+			boolean result = false;
+			result = dao.setDelete(no);
+
+			if (result) {
+				out.println("<script>alert('삭제 성공')</script>");
+				viewPage = "list.do";
+			} else {
+				out.println("<script>alert('삭제 실패')</script>");
+				viewPage = "list.do";
+			}
+
+			out.println("<script>location.href='list.do'</script>");
+
+		} else if (url.indexOf("update.do") != -1) {
+
+			viewPage = "/view/update.jsp";
+			RequestDispatcher goUrl = request.getRequestDispatcher(viewPage);
+			goUrl.forward(request, response);
+
+		} else if (url.indexOf("updateComplite.do") != -1) {
+
+			int no = Integer.parseInt(request.getParameter("no"));
+			String title = request.getParameter("changeTitle");
+			String writer = request.getParameter("changeWriter");
+			String contents = request.getParameter("changeContents");
+			System.out.println(no);
+			boolean result = false;
+			result = dao.setUpdate(no, title, writer, contents);
+
+			if (result) {
+				out.println("<script>alert('수정 성공')</script>");
+				viewPage = "list.do";
+			} else {
+				out.println("<script>alert('수정 실패')</script>");
+				viewPage = "list.do";
+			}
+
+			out.println("<script>location.href='list.do'</script>");
+		} else if (url.indexOf("download.do") != -1) {
+
+			System.out.print("다운로드.두 로 옴");
+			String filePath = request.getRealPath("/download");
+			File file = new File(String.valueOf(filePath) + "/" + request.getParameter("file"));
+
+		} else if (url.indexOf("replyInsert.do") != -1) {
+
+			String replyWriter = request.getParameter("replyWriter");
+			String replyContent = request.getParameter("replyContent");
+			int no = Integer.parseInt(request.getParameter("no"));
+			int password = Integer.parseInt(request.getParameter("password"));
+			int passwordCheck = Integer.parseInt(request.getParameter("passwordCheck"));
+
+			if (password == passwordCheck) {
+				boolean result = dao.setReplyInsert(replyWriter, replyContent, no, password);
+
+				if (result) {
+					out.println("<script>alert('등록 성공')</script>");
+					response.sendRedirect("content.do?no=" + no);
+				} else {
+					out.println("<script>alert('등록 실패')</script>");
+					response.sendRedirect("content.do?no=" + no);
+				}
+			} else {
+				out.println("<script>alert('비밀번호가 일치하지 않습니다.')</script>");
+				out.println("<script>history.go(-1)</script>");
+			}
+
+		} else if (url.indexOf("replyUpdate.do") != -1) {
+
+			int inputPassword, no = Integer.parseInt(request.getParameter("no"));
+			int upNo = Integer.parseInt(request.getParameter("upNo"));
+			String changedReplyWriter = request.getParameter("changedReplyWriter");
+			String changedReplyContent = request.getParameter("changedReplyContent");
+
+			int bringPassword = dao.getPassword(no);
+			String inputPassword1 = request.getParameter("inputPassword");
+
+			if (inputPassword1.equals("")) {
+				inputPassword = 0;
+			} else {
+				inputPassword = Integer.parseInt(request.getParameter("inputPassword"));
+			}
+			if (inputPassword == 0) {
+				out.println("<script>alert('비밀번호를 입력하세요!')</script>");
+				out.println("<script>history.go(-1)</script>");
+			} else if (bringPassword == inputPassword) {
+				boolean result = dao.setUpdateReply(no, changedReplyWriter, changedReplyContent);
+				if (result) {
+					out.println("<script>alert('수정 성공')</script>");
+					response.sendRedirect("content.do?no=" + upNo);
+				} else {
+					out.println("<script>alert('수정 실패')</script>");
+					response.sendRedirect("content.do?no=" + upNo);
+				}
+			} else {
+				out.println("<script>alert('비밀번호가 일치하지 않습니다.!')</script>");
+				out.println("<script>history.go(-1)</script>");
+			}
+
+		} else if (url.indexOf("replyDelete.do") != -1) {
+
+			int inputPassword, no = Integer.parseInt(request.getParameter("no"));
+			int upNo = Integer.parseInt(request.getParameter("upNo"));
+			int bringPassword = dao.getPassword(no);
+			String inputPassword1 = request.getParameter("inputPassword");
+
+			if (inputPassword1.equals("")) {
+				inputPassword = 0;
+			} else {
+				inputPassword = Integer.parseInt(request.getParameter("inputPassword"));
+			}
+			if (inputPassword != bringPassword) {
+				out.println("<script>alert('비밀번호가 일치하지 않습니다.!')</script>");
+				out.println("<script>history.go(-1)</script>");
+			} else {
+				boolean result = dao.setReplyDelete(no);
+				if (result) {
+					response.sendRedirect("content.do?no=" + upNo);
+				} else {
+					response.sendRedirect("content.do?no=" + upNo);
+				}
+			}
+		} else if (url.indexOf("answerWriteFront.do") != -1) {
+
+			viewPage = "/view/answerWriteFront.jsp";
+			RequestDispatcher goUrl = request.getRequestDispatcher(viewPage);
+			goUrl.forward(request, response);
+
+		} else if (url.indexOf("answerWriteBack") != -1) {
+
+			int motherNo = Integer.parseInt(request.getParameter("motherNo"));
+			String answerWriter = request.getParameter("answerWriter");
+			String answerTitle = request.getParameter("answerTitle");
+			String answerContent = request.getParameter("answerContents");
+
+			Date date = new Date();
+			SimpleDateFormat simpleDate = new SimpleDateFormat("yyyy-MM-dd");
+			String strdate = simpleDate.format(date);
+
+			Calendar cal = Calendar.getInstance();
+
+			int mondifyedMonth = cal.get(2) + 1;
+
+			String inputDate = String.valueOf(cal.get(1)) + "-" + mondifyedMonth + "-" + cal.get(5);
+
+			boolean result = dao.setAnswerInsert(answerWriter, answerTitle, answerContent, motherNo, inputDate);
+			
+			if (result) {
+				out.println("<script>alert('등록 성공')</script>");
+				viewPage = "list.do";
+			} else {
+				out.println("<script>alert('등록 실패')</script>");
+				viewPage = "list.do";
+			}
+			out.println("<script>location.href='list.do'</script>");
+
+		} else {
+
+			System.out.println("Servlet else");
+		}
+	}
+
+	/**
+	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
+	 *      response)
+	 */
+	protected void doPost(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		doGet(request, response);
+	}
+
+}
 
src/main/java/model/MemberDAO.java (added)
+++ src/main/java/model/MemberDAO.java
@@ -0,0 +1,671 @@
+package model;
+
+import config.Database;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.List;
+import model.MemberDTO;
+import model.ReplyDTO;
+
+public class MemberDAO {
+
+	
+	Connection conn;
+	PreparedStatement pstmt;
+	PreparedStatement pstmt2;
+	PreparedStatement pstmt3;
+	PreparedStatement pstmt4;
+	PreparedStatement pstmt5;
+	ResultSet rs;
+	ResultSet rs2;
+	ResultSet rs3;
+	ResultSet rs4;
+	ResultSet rs5;
+
+	public List<MemberDTO> MemberList(String option, String searchText, int pageStart) {
+		List<MemberDTO> list = new ArrayList<MemberDTO>();
+
+		conn = null;
+		pstmt = null;
+		rs = null;
+		String query = "";
+		String query2 = "update user set listNum = ?";
+		
+		int data = 0;
+		if (searchText == null) {
+			query = "select * from user order by listNum desc, depth asc limit ?, 7";
+			data = 0;
+		} else if (option.equals("title")) {
+			query = "select * from user where title like ? order by no desc limit ?, 7";
+			data = 1;
+		} else if (option.equals("writer")) {
+			query = "select * from user where writer like ? order by no desc limit ?, 7";
+			data = 2;
+		}
+
+		try {
+			conn = Database.getConnection();
+			if (data == 0) {
+				pstmt = conn.prepareStatement(query);
+				pstmt.setInt(1, pageStart);
+			} else {
+				pstmt = conn.prepareStatement(query);
+
+				pstmt.setString(1, "%" + searchText + "%");
+				pstmt.setInt(2, pageStart);
+			}
+			rs = pstmt.executeQuery();
+			while (rs.next()) {
+				int no = rs.getInt("no");
+				String writer = rs.getString("writer");
+				String title = rs.getString("title");
+				String contents = rs.getString("contents");
+				String date = rs.getString("date");
+				int view = rs.getInt("view");
+				int listNum = rs.getInt("listNum");
+				int depth = rs.getInt("depth");
+
+				MemberDTO dto = new MemberDTO();
+
+				dto.setNo(no);
+				dto.setWriter(writer);
+				dto.setTitle(title);
+				dto.setContents(contents);
+				dto.setDate(date);
+				dto.setView(view);
+				dto.setListNum(listNum);
+				dto.setDepth(depth);
+
+				list.add(dto);
+			}
+			return list;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+	}
+
+	public MemberDTO getMember(int no) {
+		conn = null;
+		pstmt = null;
+		rs = null;
+
+		String query = "select * from user where no = ?";
+
+		try {
+			conn = Database.getConnection();
+			pstmt = conn.prepareStatement(query);
+			pstmt.setInt(1, no);
+			rs = pstmt.executeQuery();
+			rs.next();
+
+			MemberDTO member = new MemberDTO();
+			member.setWriter(rs.getString("writer"));
+			member.setTitle(rs.getString("title"));
+			member.setContents(rs.getString("contents"));
+			member.setDate(rs.getString("date"));
+			member.setFile(rs.getString("file"));
+			member.setView(rs.getInt("view"));
+
+			return member;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+	}
+
+	public boolean setInsert(String writer, String title, String contents, int view, String inputDate) {
+		conn = null;
+		pstmt = null;
+		rs = null;
+		boolean result = false;
+
+		String query = "insert into user values(?, ?, ?, ?, ?, ?, ?, ?, ?)";
+
+		try {
+			conn = Database.getConnection();
+			pstmt = conn.prepareStatement(query);
+			pstmt.setString(1, null);
+			pstmt.setString(2, writer);
+			pstmt.setString(3, title);
+			pstmt.setString(4, contents);
+			pstmt.setString(5, inputDate);
+			pstmt.setInt(6, view);
+			pstmt.setString(7, null);
+			pstmt.setInt(8, 0);     /*ÇØ´ç ±ÛÀÇ no¸¦ listNumÀ¸·Î ³Ö±â*/
+			pstmt.setInt(9, 0);
+			pstmt.executeUpdate();
+
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+	}
+
+	public boolean setDelete(int no) {
+		conn = null;
+		pstmt = null;
+		rs = null;
+		boolean result = false;
+
+		String query = "delete from user where no = ?";
+
+		try {
+			conn = Database.getConnection();
+			pstmt = conn.prepareStatement(query);
+			pstmt.setInt(1, no);
+			pstmt.executeUpdate();
+
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+	}
+
+	public boolean setUpdate(int no, String writer, String title, String contents) {
+		conn = null;
+		pstmt = null;
+		rs = null;
+		boolean result = false;
+
+		String query = "update user set title=?, writer=?, contents=? where no=?";
+
+		try {
+			conn = Database.getConnection();
+			pstmt = conn.prepareStatement(query);
+			pstmt.setString(1, writer);
+			pstmt.setString(2, title);
+			pstmt.setString(3, contents);
+			pstmt.setInt(4, no);
+			pstmt.executeUpdate();
+
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+	}
+
+	public boolean setCountUpdate(int no, int view) {
+		conn = null;
+		pstmt = null;
+		rs = null;
+		boolean result = false;
+
+		String query = "update user set view=? where no=?";
+
+		try {
+			conn = Database.getConnection();
+			pstmt = conn.prepareStatement(query);
+			pstmt.setInt(1, view);
+			pstmt.setInt(2, no);
+			pstmt.executeUpdate();
+
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+	}
+
+	public int getCount() {
+		conn = null;
+		pstmt = null;
+		rs = null;
+
+		int count = 0;
+		String sql = "select count(*) from user";
+		try {
+			conn = Database.getConnection();
+			pstmt = conn.prepareStatement(sql);
+			rs = pstmt.executeQuery();
+			if (rs.next()) {
+				count = rs.getInt(1);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+		return count;
+	}
+
+	public int getCountFor(String option, String searchText) {
+		conn = null;
+		pstmt = null;
+		rs = null;
+
+		String query = "";
+		int data = 0;
+		if (searchText == null) {
+			query = "select count(*) from user";
+			data = 0;
+		} else if (option.equals("title")) {
+			query = "select count(*) from user where title like ?";
+			data = 1;
+		} else if (option.equals("writer")) {
+			query = "select count(*) from user where writer like ?";
+			data = 2;
+		}
+
+		int count = 0;
+		try {
+			conn = Database.getConnection();
+			if (data == 1) {
+				pstmt = conn.prepareStatement(query);
+				pstmt.setString(1, "%" + searchText + "%");
+			} else if (data == 2) {
+				pstmt = conn.prepareStatement(query);
+				pstmt.setString(1, "%" + searchText + "%");
+			} else {
+				pstmt = conn.prepareStatement(query);
+			}
+			rs = pstmt.executeQuery();
+			if (rs.next()) {
+				count = rs.getInt(1);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+		return count;
+	}
+
+	public boolean setReplyInsert(String repleyWriter, String repleyContent, int no, int password) {
+		conn = null;
+		pstmt = null;
+		rs = null;
+		boolean result = false;
+
+		String query = "insert into reply values(?, ?, ?, ?, ?)";
+
+		try {
+			conn = Database.getConnection();
+			pstmt = conn.prepareStatement(query);
+			pstmt.setString(1, null);
+			pstmt.setInt(2, no);
+			pstmt.setString(3, repleyWriter);
+			pstmt.setString(4, repleyContent);
+			pstmt.setInt(5, password);
+			pstmt.executeUpdate();
+
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+	}
+
+	public List<ReplyDTO> ReplyList(int no) {
+		List<ReplyDTO> list2 = new ArrayList<ReplyDTO>();
+
+		conn = null;
+		pstmt = null;
+		rs = null;
+
+		String query = "select * from reply where col_num=?";
+
+		try {
+			conn = Database.getConnection();
+			pstmt = conn.prepareStatement(query);
+			pstmt.setInt(1, no);
+			rs = pstmt.executeQuery();
+
+			while (rs.next()) {
+				int no1 = rs.getInt("num");
+				int colNo = rs.getInt("col_num");
+				String replyWriter = rs.getString("reply_writer");
+				String replyContent = rs.getString("reply_content");
+
+				ReplyDTO dto = new ReplyDTO();
+
+				dto.setNo(no1);
+				dto.setColNo(colNo);
+				dto.setReplyWriter(replyWriter);
+				dto.setReplyContent(replyContent);
+
+				list2.add(dto);
+			}
+
+			return list2;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+	}
+
+	public boolean setUpdateReply(int no, String changedRepltWriter, String changedReplyContent) {
+		conn = null;
+		pstmt = null;
+		rs = null;
+		boolean result = false;
+
+		String query = "update reply set reply_writer=?, reply_content=? where num=?";
+
+		try {
+			conn = Database.getConnection();
+			pstmt = conn.prepareStatement(query);
+			pstmt.setString(1, changedRepltWriter);
+			pstmt.setString(2, changedReplyContent);
+			pstmt.setInt(3, no);
+			pstmt.executeUpdate();
+
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+	}
+
+	public boolean setReplyDelete(int no) {
+		conn = null;
+		pstmt = null;
+		rs = null;
+		boolean result = false;
+
+		String query = "delete from reply where num = ?";
+
+		try {
+			conn = Database.getConnection();
+			pstmt = conn.prepareStatement(query);
+			pstmt.setInt(1, no);
+			pstmt.executeUpdate();
+
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+	}
+
+	public int getPassword(int no) {
+		conn = null;
+		pstmt = null;
+		rs = null;
+		int password = 0;
+
+		String query = "select pw from reply where num = ?";
+		try {
+			conn = Database.getConnection();
+			pstmt = conn.prepareStatement(query);
+			pstmt.setInt(1, no);
+			rs = pstmt.executeQuery();
+			if (rs.next()) {
+				password = rs.getInt(1);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+		return password;
+	}
+
+	public boolean setAnswerInsert(String answerWriter, String answerTitle, String answerContent, int motherNo, String inputDate) {
+		conn = null;
+		pstmt = null;
+		rs = null;
+		rs2 = null;
+		boolean result = false;
+
+		String query = "insert into user values(?, ?, ?, ?, ?, ?, ?, ?, ?)";   //insert
+		String query2 = "select depth from user where no = ?";                 //depth check
+		String query3 = "update user set listNum=? where no=? and depth=?";    //root content listNum update
+		String query4 = "select listNum from user where no = ?";
+		String query5 = "select listNum from user where depth=? and listNum=?";
+		try {
+			int motherDepth = 0;
+			int motherListNum = 0;
+			int motherRootListNum = 0;
+			conn = Database.getConnection();
+			
+			pstmt4 = conn.prepareStatement(query4);
+			pstmt4.setInt(1, motherNo);
+			rs4 = pstmt4.executeQuery();
+			if(rs4.next()) {
+				motherListNum = rs4.getInt(1);
+			}
+			
+/*******************************************************************************************/
+			pstmt5 = conn.prepareStatement(query5);
+			pstmt5.setInt(1, 0);
+			pstmt5.setInt(2, motherListNum);
+			rs5 = pstmt5.executeQuery();
+			if(rs5.next()) {
+				motherRootListNum = rs5.getInt(1);
+			}
+
+/*******************************************************************************************/
+			pstmt3 = conn.prepareStatement(query3);
+			pstmt3.setInt(1, motherNo);
+			pstmt3.setInt(2, motherNo);
+			pstmt3.setInt(3, 0);
+			pstmt3.executeUpdate();
+/*******************************************************************************************/
+			pstmt2 = conn.prepareStatement(query2);
+			pstmt2.setInt(1, motherNo);
+			rs2 = pstmt2.executeQuery();
+			if (rs2.next()) {
+				motherDepth = rs2.getInt(1);
+			}
+/*************************************************************************************************/
+			pstmt = conn.prepareStatement(query);
+			pstmt.setString(1, null);
+			pstmt.setString(2, answerWriter);
+			pstmt.setString(3, answerTitle);
+			pstmt.setString(4, answerContent);
+			pstmt.setString(5, inputDate);
+			pstmt.setInt(6, 1);     //view
+			pstmt.setString(7, null);     //file
+			
+			if(motherDepth == 0) {    /*ù ´ä±ÛÀ϶§*/
+				pstmt.setInt(8, motherNo);
+			}else {
+				pstmt.setInt(8, motherRootListNum);   /*ÀÌÁß ´ä±ÛÀ϶§*/				
+			}
+			pstmt.setInt(9, motherDepth + 1); /* ºÎ¸ð±Û depthÀÇ +1 */
+			pstmt.executeUpdate();
+
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		} finally {
+			try {
+				if (rs != null) {
+					rs.close();
+				}
+				if (pstmt != null) {
+					pstmt.close();
+				}
+				if (conn != null) {
+					conn.close();
+				}
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+		}
+	}
+
+}
 
src/main/java/model/MemberDTO.java (added)
+++ src/main/java/model/MemberDTO.java
@@ -0,0 +1,92 @@
+package model;
+
+public class MemberDTO {
+
+	private int no;
+	private String writer;
+	private String title;
+	private String contents;
+	private String date;
+	private String file;
+	private int view;
+	private int listNum;
+	private int depth;
+
+	public int getListNum() {
+		return listNum;
+	}
+
+	public void setListNum(int listNum) {
+		this.listNum = listNum;
+	}
+
+	public int getDepth() {
+		return depth;
+	}
+
+	public void setDepth(int depth) {
+		this.depth = depth;
+	}
+
+	public String getFile() {
+		return this.file;
+	}
+
+	public void setFile(String file) {
+		this.file = file;
+	}
+
+	public String getDate() {
+		return this.date;
+	}
+
+	public void setDate(String date) {
+		this.date = date;
+	}
+
+	public int getView() {
+		return this.view;
+	}
+
+	public void setView(int view) {
+		this.view = view;
+	}
+
+//	public String toString() {
+//		return "MemberDTO [no=" + this.no + ", writer=" + this.writer + ", title=" + this.title + ", contents="
+//				+ this.contents + ", view=" + this.view + "]\n";
+//	}
+
+	public int getNo() {
+		return this.no;
+	}
+
+	public void setNo(int no) {
+		this.no = no;
+	}
+
+	public String getWriter() {
+		return this.writer;
+	}
+
+	public void setWriter(String writer) {
+		this.writer = writer;
+	}
+
+	public String getTitle() {
+		return this.title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public String getContents() {
+		return this.contents;
+	}
+
+	public void setContents(String contents) {
+		this.contents = contents;
+	}
+
+}
 
src/main/java/model/ReplyDTO.java (added)
+++ src/main/java/model/ReplyDTO.java
@@ -0,0 +1,33 @@
+package model;
+
+public class ReplyDTO {
+
+	private int no;
+	  private int colNo;
+	  private String replyWriter;
+	  private String replyContent;
+	  
+	  public int getNo() { return this.no; }
+
+	  
+	  public void setNo(int no) { this.no = no; }
+
+	  
+	  public int getColNo() { return this.colNo; }
+
+	  
+	  public void setColNo(int colNo) { this.colNo = colNo; }
+
+	  
+	  public String getReplyWriter() { return this.replyWriter; }
+
+	  
+	  public void setReplyWriter(String replyWriter) { this.replyWriter = replyWriter; }
+
+	  
+	  public String getReplyContent() { return this.replyContent; }
+
+	  
+	  public void setReplyContent(String replyContent) { this.replyContent = replyContent; }
+	
+}
 
src/main/webapp/META-INF/MANIFEST.MF (added)
+++ src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+
 
src/main/webapp/WEB-INF/lib/cos-05Nov2002.jar (Binary) (added)
+++ src/main/webapp/WEB-INF/lib/cos-05Nov2002.jar
Binary file is not shown
 
src/main/webapp/WEB-INF/lib/cos.jar (Binary) (added)
+++ src/main/webapp/WEB-INF/lib/cos.jar
Binary file is not shown
 
src/main/webapp/WEB-INF/lib/jstl-1.2.jar (Binary) (added)
+++ src/main/webapp/WEB-INF/lib/jstl-1.2.jar
Binary file is not shown
 
src/main/webapp/WEB-INF/lib/mysql-connector-java-5.1.49.jar (Binary) (added)
+++ src/main/webapp/WEB-INF/lib/mysql-connector-java-5.1.49.jar
Binary file is not shown
 
src/main/webapp/WEB-INF/lib/mysql-connector-java-8.0.26.jar (Binary) (added)
+++ src/main/webapp/WEB-INF/lib/mysql-connector-java-8.0.26.jar
Binary file is not shown
 
src/main/webapp/WEB-INF/lib/taglibs-standard-impl-1.2.5.jar (Binary) (added)
+++ src/main/webapp/WEB-INF/lib/taglibs-standard-impl-1.2.5.jar
Binary file is not shown
 
src/main/webapp/WEB-INF/web.xml (added)
+++ src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
+  <display-name>WebTest</display-name>
+    <display-name>Apache-Axis</display-name>
+    <servlet>
+        <display-name>Apache-Axis Servlet</display-name>
+        <servlet-name>AxisServlet</servlet-name>
+        <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
+    </servlet>
+    <servlet>
+        <display-name>Axis Admin Servlet</display-name>
+        <servlet-name>AdminServlet</servlet-name>
+        <servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class>
+        <load-on-startup>100</load-on-startup>
+    </servlet>
+    <servlet>
+        <display-name>SOAPMonitorService</display-name>
+        <servlet-name>SOAPMonitorService</servlet-name>
+        <servlet-class>org.apache.axis.monitor.SOAPMonitorService</servlet-class>
+        <init-param>
+            <param-name>SOAPMonitorPort</param-name>
+            <param-value>5101</param-value>
+        </init-param>
+        <load-on-startup>100</load-on-startup>
+    </servlet>
+    <servlet>
+    	<servlet-name>FileTestServlet</servlet-name>
+    	<servlet-class>com.FileTest.FileTestServlet</servlet-class>
+    </servlet>
+    <servlet-mapping>
+    	<servlet-name>FileTestServlet</servlet-name>
+    	<url-pattern>/file/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>AxisServlet</servlet-name>
+        <url-pattern>/servlet/AxisServlet</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>AxisServlet</servlet-name>
+        <url-pattern>*.jws</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>AxisServlet</servlet-name>
+        <url-pattern>/services/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>SOAPMonitorService</servlet-name>
+        <url-pattern>/SOAPMonitor</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>AdminServlet</servlet-name>
+        <url-pattern>/servlet/AdminServlet</url-pattern>
+    </servlet-mapping>
+    <mime-mapping>
+        <extension>wsdl</extension>
+        <mime-type>text/xml</mime-type>
+    </mime-mapping>
+    <welcome-file-list>
+    <welcome-file>index.html</welcome-file>
+    <welcome-file>index.htm</welcome-file>
+    <welcome-file>index.jsp</welcome-file>
+    <welcome-file>default.html</welcome-file>
+    <welcome-file>default.htm</welcome-file>
+    <welcome-file>default.jsp</welcome-file>
+  </welcome-file-list>
+  <context-param>
+  	<param-name>global</param-name>
+  	<param-value>My WebSite</param-value>
+  </context-param>
+  <servlet>
+	<servlet-name>main</servlet-name>
+	<servlet-class>servlet.Main</servlet-class>  
+	<init-param>
+		<param-name>title</param-name>
+		<param-value>Main Page</param-value>
+	</init-param>
+  </servlet>
+  
+  <servlet>
+  	<servlet-name>testpage</servlet-name>
+  	<jsp-file>/test.jsp</jsp-file>
+  	<init-param>
+  		<param-name>name</param-name>
+  		<param-value>홍길동</param-value>
+  	</init-param>
+  	<init-param>
+  		<param-name>age</param-name>
+  		<param-value>10</param-value>
+  	</init-param>
+  </servlet>
+  
+  <servlet>
+  	<servlet-name>testpage2</servlet-name>
+  	<jsp-file>/test2.jsp</jsp-file>
+  </servlet>
+  
+  <servlet-mapping>
+	<servlet-name>main</servlet-name>
+	<url-pattern>/main</url-pattern>  
+  </servlet-mapping>
+  
+  <servlet-mapping>
+  	<servlet-name>testpage</servlet-name>
+  	<url-pattern>/test</url-pattern>
+  </servlet-mapping>
+  
+  <servlet-mapping>
+  	<servlet-name>testpage2</servlet-name>
+  	<url-pattern>/test2</url-pattern>
+  </servlet-mapping>
+  
+</web-app>
 
src/main/webapp/view/answerWriteFront.jsp (added)
+++ src/main/webapp/view/answerWriteFront.jsp
@@ -0,0 +1,45 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+	pageEncoding="UTF-8"%>
+<!DOCTYPE html>
+<html lang="ko">
+<head>
+<meta charset="UTF-8">
+<title>Insert title here</title>
+<style>
+#page {
+	background-color: antiquewhite;
+	width: 80%;
+	margin: 0 auto;
+	text-align: center;
+	height: 430px;
+}
+#inputContent{
+	width: 80%;
+	height: 200px;
+}
+#submit{
+	float: right;
+}
+#bottomSector{
+	width: 100%;
+}
+#btn{
+	float: right;
+}
+</style>
+</head>
+<body>
+	<div id="page">
+		<h1>This is answerWrite Page</h1>
+		<hr />
+		<%int motherNo = Integer.parseInt(request.getParameter("motherNo")); %>
+		<form action="answerWriteBack?motherNo=<%=motherNo %>" method="post" id="form" >
+			작성자 : <input type="text" name="answerWriter"><br />
+			제목 : <input type="text" name="answerTitle"><br />
+			내용 : <textarea id="inputContent" name="answerContents"></textarea><br /> 
+			<input id="submit" type="submit" value="등록">
+		</form>
+		<div id="bottomSector"><button id="btn" onclick="location.href='list.do'">목록</button></div>
+	</div>
+</body>
+</html>(No newline at end of file)
 
src/main/webapp/view/content.jsp (added)
+++ src/main/webapp/view/content.jsp
@@ -0,0 +1,169 @@
+<%@page import="model.ReplyDTO"%>
+<%@page import="java.util.List"%>
+<%@page import="java.util.Map"%>
+<%@page import="model.MemberDTO"%>
+<%@page import="model.MemberDAO"%>
+<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+	pageEncoding="UTF-8"%>
+<%
+int no = Integer.parseInt(request.getParameter("no"));
+MemberDAO dao = new MemberDAO();
+MemberDTO member = new MemberDTO();
+member = dao.getMember(no);
+%>
+<!DOCTYPE html>
+<html lang="ko">
+<head>
+<meta charset="UTF-8">
+<title>Insert title here</title>
+<style>
+#page {
+	background-color: antiquewhite;
+	width: 80%;
+	margin: 0 auto;
+}
+
+#top {
+	text-align: center;
+}
+
+#middle {
+	text-align: right;
+}
+
+#mainContents {
+	background-color: white;
+	width: 95%;
+	height: 300px;
+	border: 1px black solid;
+	margin-left: 25px;
+}
+
+#innerContents {
+	margin-left: 30px;
+}
+
+#crudButton {
+	text-align: right;
+	margin-right: 25px;
+}
+#replySector {
+	width: 100%;
+	border-top: 10px solid white;
+}
+
+#replyForm{
+	width: 55%;
+}
+
+#replySubmit{
+	text-align: right;
+}
+
+#repleyPrintSector{
+	width: 100%;
+	border-top: 10px solid white;
+}
+
+#replyTitle{
+	width: 100%;
+	text-align: center;
+	border-bottom: 1px solid white;
+}
+
+#replyArea{
+	text-align:center;
+	width: 100%;
+	border-bottom: 3px solid white;
+}
+
+#replyWriter{
+	width: 22%;
+	text-align: center;
+}
+
+#replyBtns{
+	width: 100%;
+	text-align: center;}
+</style>
+</head>
+	<%
+		Map<String, Object> map = (Map<String, Object>) request.getAttribute("map");
+		List<ReplyDTO> list = (List<ReplyDTO>) map.get("list2");
+		int count = (int) map.get("count");
+	%>
+<body>
+	<div id="page">
+		<div id="top">
+			<h1>
+				제목 :
+				<%=member.getTitle()%><br />
+			</h1>
+		</div>
+		<hr />
+		<div id="middle">
+			<em>번호</em> : <strong><%=no%></strong>
+			<em>작성자</em> : <strong><%=member.getWriter()%></strong>
+			<em>작성일</em> : <strong><%=member.getDate()%></strong>
+			<em>조회수</em> : <strong><%=member.getView()%></strong>
+		</div>
+		<br />
+		<div id="mainContents">
+			<p id="innerContents">
+				<%=member.getContents()%>
+			</p>
+		</div>
+			<br>
+			<%
+				if(member.getFile() == null){
+					out.println("첨부파일 : <em>첨부된 파일이 없습니다.</em>");
+				}else{%>
+					첨부파일 : <a href="download.do?file=<%=member.getFile() %>"><%=member.getFile() %></a>
+				<%}
+				
+			%>
+		<div id="crudButton">
+			<br />
+			<button onClick="location.href='update.do?no=<%=no%>'">수정</button>
+			<button onClick="location.href='delete.do?no=<%=no%>'">삭제</button>
+			<button onClick="location.href='list.do'">목록</button>
+			<button onClick="location.href='answerWriteFront.do?motherNo=<%=no%>'">답글</button>
+		</div>
+		<div id="replySector">
+			<form action="replyInsert.do?no=<%=no %>" id="replyForm" method="post">
+				작성자 : <input type="text" name="replyWriter"><br /><br />
+				댓글 : <textarea name="replyContent" id="" cols="80" rows="10"></textarea> <br /><br />
+				비밀번호 : <input type="password" name="password">
+				비밀번호 확인 : <input type="password" name="passwordCheck">
+				<div id="replySubmit">
+					<input  type="submit" value="등록">	
+				</div>
+			</form>
+		</div>
+		<div id="repleyPrintSector">
+			<div id="replyTitle"><h2>댓글</h2></div>
+			<%for(ReplyDTO rd : list) { %>
+				<div id="replyArea">
+					<form method="post">
+						<div id="replyWriter">작성자 : <input type="text" value="<%=rd.getReplyWriter() %>" name="changedReplyWriter"><br /> <br /></div>
+						댓글 : <textarea cols="160" name="changedReplyContent"><%=rd.getReplyContent() %></textarea><br /><br /><br />
+						<div id="replyWriter">비밀번호 : <input type="password" name="inputPassword"></div>
+						<div id="replyBtns">
+							<input type="submit" formaction="replyUpdate.do?no=<%=rd.getNo() %>&upNo=<%=no %>" value="수정">
+							<input type="submit" formaction="replyDelete.do?no=<%=rd.getNo() %>&upNo=<%=no %>" value="삭제">
+						</div>
+					</form>
+				</div>
+			<%} %>
+		</div>
+	</div>
+</body>
+</html>
+
+
+
+
+
+
+
 
src/main/webapp/view/list.jsp (added)
+++ src/main/webapp/view/list.jsp
@@ -0,0 +1,334 @@
+<%@page import="model.MemberDAO"%>
+<%@page import="model.MemberDTO"%>
+<%@page import="java.util.List"%>
+<%@page import="java.util.Map"%>
+<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+	pageEncoding="UTF-8"%>
+<!DOCTYPE html>
+<html lang="ko">
+<head>
+<meta charset="UTF-8">
+<title>Insert title here</title>
+<style>
+#page {
+	background-color: antiquewhite;
+	width: 80%;
+	height: auto;
+	margin: 0 auto;
+	text-align: center;
+	margin: 0 auto;
+}
+
+#title {
+	text-decoration: none;
+	color: black;
+}
+
+#title:hover {
+	background-color: tomato;
+}
+
+#table {
+	text-align: center;
+	width: 100%;
+	height: 400px;
+	border-collapse: collapse;
+	border-bottom: white;
+	border-style : 1px solid white;
+	border-right: none;
+	border-left: none;
+}
+
+th {
+	border-top: midnightblue solid;
+	border-bottom: midnightblue solid;
+	background-color: cadetblue;
+}
+
+td{
+	font-size: 15px;
+}
+
+#pageNumber {
+	text-align: right;
+}
+
+#titleAnker {
+	text-decoration: none;
+	color: black;
+}
+
+#titleAnker:hover {
+	color: red;
+}
+
+#topSector {
+	width: 100%;
+}
+
+#count {
+	display: inline-block;
+	float: left;
+}
+
+#search {
+	float: right;
+}
+
+#btn {
+	float: right;
+	border: 1px solid black;
+}
+
+#btn:hover {
+	background-color: black;
+	color: white;
+}
+
+#searchBtn {
+	border: 1px solid black;
+}
+
+#searchBtn:hover {
+	background-color: black;
+	color: white;
+}
+
+#pageNumberSector>a {
+	text-decoration: none;
+}
+
+#h2 {
+	display: inline-block;
+}
+
+#pagingBtn {
+	text-decoration: none;
+	color: black;
+}
+
+#pagingBtn:hover {
+	background-color: black;
+	color: white;
+}
+
+#bottomSector {
+	width: 100%;
+}
+</style>
+</head>
+<body>
+	<%
+	Map<String, Object> map = (Map<String, Object>) request.getAttribute("map");
+	List<MemberDTO> list = (List<MemberDTO>) map.get("list");
+	int count = (int) map.get("count");
+	%>
+
+	<div id="page">
+		<a id="titleAnker" href="list.do"><h1>
+				<em>JSP_Notice Board</em>
+			</h1></a>
+		<div id="topSector">
+			<span id="count">전체<%=count%>건
+			</span>
+			<form id="search" action="list.do" method="get">
+				<select name="option">
+					<option name="title" value="title">제목</option>
+					<option name="writer" value="writer">작성자</option>
+				</select> <input type="text" name="searchText"> <input id="searchBtn"
+					type="submit" value="검색">
+			</form>
+			<br> <br>
+		</div>
+		<table id="table" border="1" width="100%" height="400">
+			<thead>
+				<tr>
+					<th>번호</th>
+					<th>제목</th>
+					<th>작성자</th>
+					<th>날짜</th>
+					<th>조회수</th>
+				</tr>
+			</thead>
+			<%
+			for (MemberDTO mb : list) {
+			%>
+			<tbody>
+				<tr>
+					<td>
+						<%
+						if(mb.getDepth() != 0){
+							
+						}else{
+							out.println(mb.getNo());
+						}
+						
+						%>
+					</td>
+					<td>
+						<%
+							if(mb.getDepth() > 0){
+								out.println("<img height=1 width='" + mb.getDepth()*20 + "'>└> RE:");
+							}else{
+								
+							}
+						%>
+						<a id="title" href="content.do?no=<%=mb.getNo()%>&view=<%=mb.getView() + 1%>"><strong><%=mb.getTitle()%></strong></a>
+					</td>
+					<td>
+						<%
+						if (mb.getWriter().equals("Anonymous")) {
+							out.println("<em>" + mb.getWriter() + "</em>");
+						} else {
+							out.println(mb.getWriter());
+						}
+						%>
+					</td>
+					<td><%=mb.getDate()%></td>
+					<td><%=mb.getView()%></td>
+				</tr>
+			</tbody>
+			<%
+			}
+			%>
+		</table>
+		<br />
+		<div id="pageNumberSector">
+			<%
+			MemberDAO dao = new MemberDAO();
+			String searchText = request.getParameter("searchText");
+			String option = request.getParameter("option");
+			int allCount = dao.getCountFor(option, searchText);
+
+			int list2 = 7;
+			String nowPage = request.getParameter("page");
+			int currentPage;
+			if (nowPage != null) {
+				currentPage = Integer.parseInt(nowPage);
+			} else {
+				currentPage = 1;
+			}
+			int blockCnt = 3;
+
+			double blockNum1 = Math.ceil((double) currentPage / (double) blockCnt);
+			int blockNum = (int) blockNum1;
+			int blockStart = ((blockNum - 1) * blockCnt) + 1;
+			int blockEnd = blockStart + blockCnt - 1;
+			int pageStart = (currentPage - 1) * list2;
+			double totalPage1 = Math.ceil((double) allCount / (double) list2);
+			int totalPage = (int) totalPage1;
+			if (blockEnd > totalPage) {
+				blockEnd = totalPage;
+			}
+
+			if (allCount > 7) {
+
+				if (currentPage > 1) {
+					if (request.getParameter("searchText") == null) {
+			%>
+			<a href='list.do?page=1&pageStart=0'>처음...</a>
+			<%
+			} else {
+			%>
+			<a
+				href='list.do?page=1&pageStart=0&option=<%=option%>&searchText=<%=searchText%>'>처음...</a>
+			<%
+			}
+			} else {
+
+			}
+			if (currentPage <= 1) {
+
+			} else {
+			int prePage = currentPage - 1;
+			if (request.getParameter("searchText") == null) {
+			%>
+			<a class=""
+				href='list.do?page=<%=prePage%>&pageStart=<%=prePage * 7 - 7%>'>이전</a>
+			<%
+			} else {
+			%>
+			<a class="pagingBtn"
+				href='list.do?page=<%=prePage%>&option=<%=option%>&searchText=<%=searchText%>&pageStart=<%=prePage * 7 - 7%>'>이전</a>
+			<%
+			}
+			}
+			for (int i = blockStart; i <= blockEnd; i++) {
+			if (currentPage == i) {
+			%>
+			<h2 id="h2">
+				<u><%=i%></u>
+			</h2>
+			<%
+			} else {
+			if (request.getParameter("searchText") == null) {
+			%>
+			<a class="pagingBtn"
+				href="list.do?page=<%=i%>&pageStart=<%=i * list2 - 7%>"><%=i%></a>
+			<%
+			} else {
+			%>
+			<a class="pagingBtn"
+				href="list.do?page=<%=i%>&option=<%=option%>&searchText=<%=searchText%>&pageStart=<%=i * list2 - 7%>"><%=i%></a>
+			<%
+			}
+			}
+			}
+			if (currentPage >= totalPage) {
+
+			} else {
+			int nextPage = currentPage + 1;
+			if (request.getParameter("searchText") == null) {
+			%>
+			<a class="pagingBtn"
+				href="list.do?page=<%=nextPage%>&pageStart=<%=nextPage * 7 - 7%>">다음</a>
+			<%
+			} else {
+			%>
+			<a class="pagingBtn"
+				href="list.do?page=<%=nextPage%>&option=<%=option%>&searchText=<%=searchText%>&pageStart=<%=nextPage * 7 - 7%>">다음</a>
+			<%
+			}
+			}
+			if (currentPage >= totalPage) {
+
+			} else {
+			if (request.getParameter("searchText") == null) {
+			%>
+			<a class="pagingBtn"
+				href="list.do?page=<%=totalPage%>&pageStart=<%=totalPage * 7 - 7%>">...마지막</a>
+			<%
+			} else {
+			%>
+			<a class="pagingBtn"
+				href="list.do?page=<%=totalPage%>&option=<%=option%>&searchText=<%=searchText%>&pageStart=<%=totalPage * 7 - 7%>">...마지막</a>
+			<%
+			}
+			}
+
+			} else {
+
+			}
+			%>
+		</div>
+		<div id="bottomSector">
+			<button id="btn" onClick="location.href='write.do'">글쓰기</button>
+		</div>
+	</div>
+</body>
+</html>
+
+
+
+
+
+
+
+
+
+
+
+
+
+'
 
src/main/webapp/view/login.jsp (added)
+++ src/main/webapp/view/login.jsp
@@ -0,0 +1,12 @@
+<%@ 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>
+<body>
+	This is login Page
+</body>
+</html>(No newline at end of file)
 
src/main/webapp/view/update.jsp (added)
+++ src/main/webapp/view/update.jsp
@@ -0,0 +1,81 @@
+<%@page import="model.MemberDTO"%>
+<%@page import="model.MemberDAO"%>
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+	pageEncoding="UTF-8"%>
+<%
+int no = Integer.parseInt(request.getParameter("no"));
+MemberDAO dao = new MemberDAO();
+MemberDTO member = new MemberDTO();
+member = dao.getMember(no);
+%>
+<!DOCTYPE html>
+<html lang="ko">
+<head>
+<meta charset="UTF-8">
+<title>Insert title here</title>
+<style>
+#page {
+	background-color: antiquewhite;
+	width: 80%;
+	margin: 0 auto;
+}
+
+#top {
+	text-align: center;
+}
+
+#middle {
+	text-align: right;
+}
+
+#mainContents {
+	background-color: white;
+	width: 95%;
+	height: 300px;
+	border: 1px black solid;
+	margin-left: 25px;
+}
+
+#innerContents {
+	margin-left: 30px;
+}
+
+#crudButton {
+	text-align: right;
+	margin-right: 25px;
+}
+
+#listBtn{
+	position: relative;
+	left: 1400px;
+	bottom: 24px;
+}
+
+</style>
+</head>
+<body>
+	<div id="page">
+		<form action="updateComplite.do" method="post" id="form">
+			<!-- Update 되는값들 전송 폼 -->
+			<div id="top">
+				<h1>
+					제목 : <input type="text" name="changeTitle" value="<%=member.getTitle()%>">
+				</h1>
+			</div>
+			<hr />
+			<div id="middle">
+				<em>번호</em> : <strong><%=no%></strong> <input type="hidden"
+					name="no" value="<%=no%>"> <em>작성자</em> : <input
+					type="text" name="changeWriter" value="<%=member.getWriter()%>">
+				<em>조회수</em> : <strong><%=member.getView()%></strong>
+			</div>
+			<br />
+			<textarea id="mainContents" name="changeContents"><%=member.getContents()%></textarea>
+			<div id="crudButton">
+				<br /> <input type="submit" value="확인">
+			</div>
+		</form>
+		<button id="listBtn" onClick="location.href='list.do'">목록</button>
+	</div>
+</body>
+</html>(No newline at end of file)
 
src/main/webapp/view/write.jsp (added)
+++ src/main/webapp/view/write.jsp
@@ -0,0 +1,45 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+	pageEncoding="UTF-8"%>
+<!DOCTYPE html>
+<html lang="ko">
+<head>
+<meta charset="UTF-8">
+<title>Insert title here</title>
+<style>
+#page {
+	background-color: antiquewhite;
+	width: 80%;
+	margin: 0 auto;
+	text-align: center;
+	height: 430px;
+}
+#inputContent{
+	width: 80%;
+	height: 200px;
+}
+#submit{
+	float: right;
+}
+#bottomSector{
+	width: 100%;
+}
+#btn{
+	float: right;
+}
+</style>
+</head>
+<body>
+	<div id="page">
+		<h1>This is write Page</h1>
+		<hr />
+		<form action="insert" method="post" id="form" >
+			작성자 : <input type="text" name="inputWriter"><br />
+			제목 : <input type="text" name="inputTitle"><br />
+			내용 : <textarea id="inputContent" name="inputContents"></textarea><br /> 
+			첨부파일 : <input type="file" name="file">
+			<input id="submit" type="submit" value="등록">
+		</form>
+		<div id="bottomSector"><button id="btn" onclick="location.href='list.do'">목록</button></div>
+	</div>
+</body>
+</html>(No newline at end of file)
 
target/classes/config/Database.class (Binary) (added)
+++ target/classes/config/Database.class
Binary file is not shown
 
target/classes/config/EncodingFiter.class (Binary) (added)
+++ target/classes/config/EncodingFiter.class
Binary file is not shown
 
target/classes/control/MemberServlet.class (Binary) (added)
+++ target/classes/control/MemberServlet.class
Binary file is not shown
 
target/classes/model/MemberDAO.class (Binary) (added)
+++ target/classes/model/MemberDAO.class
Binary file is not shown
 
target/classes/model/MemberDTO.class (Binary) (added)
+++ target/classes/model/MemberDTO.class
Binary file is not shown
 
target/classes/model/ReplyDTO.class (Binary) (added)
+++ target/classes/model/ReplyDTO.class
Binary file is not shown
 
target/m2e-wtp/web-resources/META-INF/MANIFEST.MF (added)
+++ target/m2e-wtp/web-resources/META-INF/MANIFEST.MF
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Build-Jdk-Spec: 16
+Created-By: Maven Integration for Eclipse
+
 
target/m2e-wtp/web-resources/META-INF/maven/WebTest/WebTest/pom.properties (added)
+++ target/m2e-wtp/web-resources/META-INF/maven/WebTest/WebTest/pom.properties
@@ -0,0 +1,7 @@
+#Generated by Maven Integration for Eclipse
+#Mon Aug 30 17:45:57 KST 2021
+m2e.projectLocation=C\:\\dev\\workspace_JSP\\JSP_Board
+m2e.projectName=JSP_Board
+groupId=WebTest
+artifactId=WebTest
+version=0.0.1-SNAPSHOT
 
target/m2e-wtp/web-resources/META-INF/maven/WebTest/WebTest/pom.xml (added)
+++ target/m2e-wtp/web-resources/META-INF/maven/WebTest/WebTest/pom.xml
@@ -0,0 +1,48 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>WebTest</groupId>
+  <artifactId>WebTest</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>war</packaging>
+  <dependencies>
+	<dependency>
+	    <groupId>mysql</groupId>
+	    <artifactId>mysql-connector-java</artifactId>
+	    <version>5.1.49</version>
+	</dependency>
+	<dependency>
+	    <groupId>org.junit.jupiter</groupId>
+	    <artifactId>junit-jupiter-api</artifactId>
+	    <version>5.7.2</version>
+	    <scope>test</scope>
+	</dependency>
+	<dependency>
+	    <groupId>javax.servlet</groupId>
+	    <artifactId>jstl</artifactId>
+	    <version>1.2</version>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.taglibs</groupId>
+	    <artifactId>taglibs-standard-impl</artifactId>
+	    <version>1.2.5</version>
+	    <scope>runtime</scope>
+	</dependency>
+	
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.8.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-war-plugin</artifactId>
+        <version>3.2.3</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>(No newline at end of file)
Add a comment
List