bitcocom/gsm31

BoardListController.java

Opened this issue · 0 comments

package kr.gsm.controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

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 kr.gsm.dao.BoardDAO;
import kr.gsm.entity.Board;
@WebServlet("/boardList.do")
public class BoardListController extends HttpServlet {	
	protected void service(HttpServletRequest request, HttpServletResponse response) 
			                                  throws ServletException, IOException {
	   // Model과 연동하기...
	   BoardDAO dao=new BoardDAO();
	   List<Board> list=dao.getList();
	   // 디버깅(미리출력) ==>View(JSP, Thymeleaf, React)
	   // 객체바인딩(특정객체에 데이터(객체)를 연결하는 기술)
	   request.setAttribute("list", list);
	   // 요청의뢰객체생성(View와 연동하기....)
	   RequestDispatcher rd=request.getRequestDispatcher("board/boardList.jsp");
	   rd.forward(request, response); //-------------------------↑
	}
}