【 Java 】 【 웹 】 웹. html 맵 설정 파일

1401 단어
웹. html 복사 프로필



    ServletDemo5
    com.demo.ServletDemo5
    
    
        encoding
        UTF-8
    



    ServletDemo5
    /demo5

public class ServletDemo5 extends HttpServlet {

    private ServletConfig config;
    
    @Override
    public void init(ServletConfig config) throws ServletException {
        this.config = config;
    }
    
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        //   :1
         String encoding = this.config.getInitParameter("encoding");
         System.out.println(encoding);
        
        //   :2
        String encoding2 = super.getInitParameter("encoding");
        System.out.println(encoding2);
        
        //   :3
        String encoding3 = this.getServletConfig().getInitParameter("encoding");
        System.out.println(encoding3);
    }
    
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
    }

}

좋은 웹페이지 즐겨찾기