본문 바로가기
국비교육

2월 12일 국비교육 49일차

by Diligejy 2019. 2. 12.

1.

Context = application 

| - Config - Server.xml : WAS 설정 파일 호출, WAS 설정(속성)

|             - Context.xml : Web Project 속성 설정 파일 ⓐworkDir설정 ⓑ DB연결 설정

|             - web.xml : webpage 설정 파일(JSP url, Servlet 설정, encoding 등 7가지)

  Session 

Request 

     | 

PageContext 

    |        | 

JSP     java=servlet 


2.

javax.servlet

Interface ServletContext



  • public interface ServletContext
    Defines a set of methods that a servlet uses to communicate with its servlet container, for example, to get the MIME type of a file, dispatch requests, or write to a log file.

    There is one context per "web application" per Java Virtual Machine. (A "web application" is a collection of servlets and content installed under a specific subset of the server's URL namespace such as /catalog and possibly installed via a .war file.)

    In the case of a web application marked "distributed" in its deployment descriptor, there will be one context instance for each virtual machine. In this situation, the context cannot be used as a location to share global information (because the information won't be truly global). Use an external resource like a database instead.

    The ServletContext object is contained within the ServletConfig object, which the Web server provides the servlet when the servlet is initialized.


3.

getAttribute, getAttributeNames()가 있으면 set도 있을 것 - 공통 method임


4.

주소 옮길 때는 getContextPath()를 이용해서 사용함



5.

javax.servlet.http

Interface HttpServletRequest



6.

javax.servlet.http

Interface HttpServletResponse



7.

* 는 0개 이상

?는 0 or 1

1개 이상은 무조건 줘야 함




8.

다음과 같은 코드 출력시



9.

PrintWriter에 대한 설명


Class PrintWriter

  • All Implemented Interfaces:
    CloseableFlushableAppendableAutoCloseable


    public class PrintWriter
    extends Writer
    Prints formatted representations of objects to a text-output stream. This class implements all of the print methods found in PrintStream. It does not contain methods for writing raw bytes, for which a program should use unencoded byte streams.

    Unlike the PrintStream class, if automatic flushing is enabled it will be done only when one of the printlnprintf, or format methods is invoked, rather than whenever a newline character happens to be output. These methods use the platform's own notion of line separator rather than the newline character.

    Methods in this class never throw I/O exceptions, although some of its constructors may. The client may inquire as to whether any errors have occurred by invoking checkError().


10.

com.biz.MemberBiz

com.vo.Member

com.dao.MemberDao

common.JDBCTemplate


11.

Session에 객체를 많이 담아서 좋을 게 없다. 


12.

JSP의 Forward는 다음과 같은 것이 가지고 있음

RequestDispatcher


13.

List<Member> all = (List<Member>)request.getAttribute("my_all"); //getAttribute의 return은 Object이기 때문에 List<Member>로 형변환

'국비교육' 카테고리의 다른 글

국비교육 50일차  (0) 2019.02.14
2월 13일 국비교육 50일차  (0) 2019.02.13
2월 11일 국비교육 48일  (0) 2019.02.11
2월 1일 국비교육  (0) 2019.02.01
1월 31일 국비교육  (0) 2019.01.31

댓글