-
[게시판] Controller프로젝트 2022. 7. 21. 12:41
WriterBoardService
package com.ptsd.controller; import java.io.IOException; import java.net.URLEncoder; 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 com.oreilly.servlet.MultipartRequest; import com.oreilly.servlet.multipart.DefaultFileRenamePolicy; import com.ptsd.model.BoardDAO; import com.ptsd.model.BoardVO; @WebServlet("/WriterBoardService1") public class WriterBoardService extends HttpServlet { private static final long serialVersionUID = 1L; protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); String TAXI_COMMENT_TITLE = request.getParameter("TAXI_COMMENT_TITLE"); String TAXI_COMMENT_WRITER = request.getParameter("TAXI_COMMENT_WRITER"); String TAXI_COMMENT_COMMENT = request.getParameter("TAXI_COMMENT_COMMENT"); String TAXI_NUM = request.getParameter("TAXI_NUM"); float RATING = Float.parseFloat(request.getParameter("RATING")); System.out.println(TAXI_COMMENT_TITLE); System.out.println(TAXI_COMMENT_WRITER); BoardVO vo = new BoardVO(TAXI_NUM, TAXI_COMMENT_TITLE, TAXI_COMMENT_WRITER, TAXI_COMMENT_COMMENT, RATING); BoardDAO dao = new BoardDAO(); int row = dao.upload(vo); System.out.println(row); if(row>0) { System.out.println("업로드 성공"); } RequestDispatcher rd = request.getRequestDispatcher("board.jsp"); rd.forward(request, response); } }
DeleteBoardService
package com.ptsd.controller; import java.io.IOException; 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 com.ptsd.model.BoardDAO; @WebServlet("/DeleteBoardService1") public class DeleteBoardService extends HttpServlet { private static final long serialVersionUID = 1L; protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int TAXI_COMMENT_SEQ = Integer.parseInt(request.getParameter("TAXI_COMMENT_SEQ")) ; BoardDAO dao = new BoardDAO(); int row = dao.ListDelete(TAXI_COMMENT_SEQ); RequestDispatcher rd = request.getRequestDispatcher("board.jsp"); rd.forward(request, response); } }
'프로젝트' 카테고리의 다른 글
[게시판] Model (0) 2022.07.21 [게시판] DataBase (0) 2022.07.21 [로그인/로그아웃] Controller (0) 2022.07.21 [회원 가입, 로그인] Model (0) 2022.07.21 [회원 가입, 로그인] DataBase (0) 2022.07.21