FrontController 기본 코드 - Limddongchul/message_practice GitHub Wiki

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

String requestURI = request.getRequestURI();
String contextPath = request.getContextPath();
String command = requestURI.substring(contextPath.length());
boolean isRedirect = true;
String dst = null;

response.setCharacterEncoding(“utf8”);
PrintWriter out = response.getWriter();

if(command.equals("")) {
}else if(command.equals("")) {
}

if(isRedirect) {
response.sendRedirect(dst);
}else {
RequestDispatcher rd = request.getRequestDispatcher(dst);
rd.forward(request, response);
}

}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}

⚠️ **GitHub.com Fallback** ⚠️