10.Servlets - yojulab/learn_servlets GitHub Wiki

Folders Architecture

Main Functions

import jakarta.servlet.*;
@WebServlet(name = "HelloWorld", urlPatterns = {"/helloWorld"})
public class HelloWorldServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse 
             response) throws ServletException, IOException {
	response.setContentType("text/html");
	PrintWriter out = response.getWriter();
        out.println("<h1>Hello World using HttpServlet class.</h1>");
        out.close();
    }
}

Beginner Function

분류 설명 비고
HttpServlet Class service(...), doGet(...), doPost(...), doDelete(...) --
Welcome-File-List In Web.Xml -- --
Annotation @WebServlet() <web-app ... metadata-complete="false"> --
RequestDispatcher Interface requestDispatcher.forward(), requestDispatcher.include(...), response.sendRedirect(relative url) --
Query String service() with Forms Request.getParameterValues(), Get, Post with Forms --

Intermediate Function

분류 설명 비고
HttpServlet Class doHead(...), doOptions(...), doPut(...), doTrace(...), getLastModified(...) --
상태 유지 cookie, Application(ServletContext), sessioin --

Advanced Function

분류 설명 비고
FilterConfig Interface Servlet Filter with <filter ...> in web.xml : @WebFilter() link --
⚠️ **GitHub.com Fallback** ⚠️