Joslynn의 하루

[Servlet] annotation과 xml 설정 본문

MSA Full-Stack 개발자 양성과정/JSP&Servlet

[Servlet] annotation과 xml 설정

Joslynn 2022. 10. 11. 14:47

xml 설정

<servlet>
	<servlet-name>boardServlet</servlet-name>
	<servlet-class>kosta.servlet.BoardService</servlet-class>
    <param-name>subject</param-name>
    <param-value>웹프로그래밍</param-value>
</servlet>
<servlet-mapping>
	<servlet-name>boardServlet</servlet-name>
    <url-pattern>/board</url-pattern>
</servlet-mapping>

 

annotation

@WebServlet(urlPatterns = { "/board" },
            initParams = { 
                  @WebInitParam(name = "subject", value = "웹프로그래밍"),
            loadOnStartup = 1
            })
       
//loadOnStartup => 사전 생성

 

Comments