10.Servlets - yojulab/learn_servlets GitHub Wiki
- Jakarta Servlet wiki(formerly Java Servlet) -> Java Servlet
- Learn Refer - first, Learn Refer - second
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();
}
}
분류 | 설명 | 비고 |
---|---|---|
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 | -- |
분류 | 설명 | 비고 |
---|---|---|
HttpServlet Class | doHead(...), doOptions(...), doPut(...), doTrace(...), getLastModified(...) | -- |
상태 유지 | cookie, Application(ServletContext), sessioin | -- |
분류 | 설명 | 비고 |
---|---|---|
FilterConfig Interface | Servlet Filter with <filter ...> in web.xml : @WebFilter() link | -- |