톰캣 DataSource 설정 및 사용

 - JDBC 드라이버를 \WEB-INF\lib 폴더에 설치

 - ConnectionPool 기능 관련 jar 파일 \WEB-INF\lib 폴더에 설치

 - %CATALINA_HOME%\context.xml에 Connection 객체 생성시 연결할 데이터베이스 정보를 jndi로 설정

 - DAO 클래스에서 DB 연동시 미리 설정한 JNDI라는 이름으로 DB와 연결하여 작업

 

포워드: 서블릿에서 다른 서블릿이나 서블릿에서 JSP로 request를 전달함

 - redirect: HttpServletResponse객체의 sendRedirect("포워드할 서블릿 또는 JSP")

 - refresh: HttpServletResponse객체의 addHeader("Refresh", "경과시간(초);url=요청할 서블릿 또는 jsp")

 - location: 자바스크립트 location 객체의 href 속성을 이용

 - dispatch: RequestDispatcher 클래스의 request.getRequestDispatcher("포워들할 서블릿 또는 jsp").forward(request, response)

 

redirect, refresh, location은 브라우저를 거쳐서 서블릿이나 JSP에 요청하는 방법

dispatch는 클라이언트를 거치지 않고 바로 서블릿으로 요청하는 방법

 

Binding

 - 웹프로그램 실행시 서블릿 관련 객체에 데이터를 저장하는 방법으로 HttpServletRequest나 HttpSession, ServletContext 에 사용 됨

 - setAttribute, getAttribute, removeAttribute

 

ServletContext와 ServletConfig

https://stackoverflow.com/questions/4223564/servletconfig-vs-servletcontext

 

ServletConfig vs ServletContext

What is the difference between ServletConfig and ServletContext interface?

stackoverflow.com

서블릿 초기화 및 load-on-startup 사용

 - web.xml

 - @WebServlet

 

+ Recent posts