-
Notifications
You must be signed in to change notification settings - Fork 0
/
GuestbookListServlet.java
32 lines (24 loc) · 1.1 KB
/
GuestbookListServlet.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package org.edwith.webbe.guestbook.servlet;
import org.edwith.webbe.guestbook.dao.GuestbookDao;
import org.edwith.webbe.guestbook.dto.Guestbook;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
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;
@WebServlet("/guestbooks")
public class GuestbookListServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html; charset=utf-8");
GuestbookDao guestBookDao = new GuestbookDao();
List<Guestbook> list = guestBookDao.getGuestbooks();
request.setAttribute("list", list);
RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher("/WEB-INF/guestbook/guestbooks.jsp");
requestDispatcher.forward(request, response);
}
}