Files
hospital-web-system/hospital/src/main/java/controller/Fcontroller.java
mcutegs2 939483e336 임직원 회원가입 DB 연결 중
- UserJoinDao, UserJoinVo, error404, error500, UserRegCommand, Menu, joinfail, joinOk, tail 추가 및 수정
2020-06-22 20:32:08 +09:00

62 lines
2.2 KiB
Java

package controller;
import java.io.IOException;
import java.util.HashMap;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
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 command.BoardViewCommand;
import command.Command;
import command.HomeCommand;
import command.UserJoinCommand;
import command.UserLoginCommand;
import command.UserRegCommand;
import command.patientJoinCommand;
import command.patientLoginCommand;
@WebServlet("/Fcontroller")
public class Fcontroller extends HttpServlet {
private static final long serialVersionUID = 1L;
HashMap<String, Command> list = null;
public Fcontroller() {
super();
// TODO Auto-generated constructor stub
}
public void init(ServletConfig config) throws ServletException {
// TODO Auto-generated method stub
list = new HashMap<String, Command>();
list.put("/home.do", new HomeCommand()); //처음 보여주는 페이지;
list.put("/UserLogin.do", new UserLoginCommand()); // 임직원 로그인 처리
list.put("/patientlogin.do", new patientLoginCommand()); // 환자 로그인 처리
list.put("/UserJoin.do", new UserJoinCommand()); // 임직원 로그인 페이지
list.put("/UserReg.do", new UserRegCommand()); // 임직원 회원가입 페이지
list.put ("/patientJoin.do", new patientJoinCommand()); // 환자 회원가입 페이지
list.put("/boardView.do", new BoardViewCommand()); // 데이터 보기 test 페이지
//이 부분에 계속적으로 매핑을 추가하면 됨
}
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("utf-8");
String uri = request.getRequestURI();
String contextPath = request.getContextPath();
String path = uri.substring(contextPath.length());
Command comm = list.get(path);
String view = comm.exec(request, response);
RequestDispatcher dispatcher = request.getRequestDispatcher(view);
dispatcher.forward(request, response);
}
}