Created
May 7, 2014 07:38
-
-
Save sjyun/9a13c8bb7223d5d3b368 to your computer and use it in GitHub Desktop.
초기화파라미터 전달
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package test0911; | |
| import java.io.IOException; | |
| import javax.servlet.ServletConfig; | |
| import javax.servlet.ServletException; | |
| import javax.servlet.annotation.WebInitParam; | |
| import javax.servlet.annotation.WebServlet; | |
| import javax.servlet.http.HttpServlet; | |
| import javax.servlet.http.HttpServletRequest; | |
| import javax.servlet.http.HttpServletResponse; | |
| @WebServlet(name = "initParamServlet", urlPatterns = "{/init}", | |
| initParams = { @WebInitParam(name = "siteName", value = "burning.com") }) | |
| public class InitParamServlet extends HttpServlet { | |
| private static final long serialVersionUID = 1L; | |
| private String myParam = ""; | |
| public void init(ServletConfig servletConfig) throws ServletException { | |
| this.myParam = servletConfig.getInitParameter("siteName"); | |
| System.out.println("사이트명은 " + myParam + "입니다."); | |
| } | |
| public void doGet(HttpServletRequest request, HttpServletResponse response) | |
| throws ServletException, IOException { | |
| System.out.println("doGet메소드 호출"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment