How to retrieve value from web.xml in Servlet?

前端 未结 3 538
情深已故
情深已故 2020-12-19 18:05

I need to retrieve init-param value from xml to Servlet i used following code


    LoginServlet
    &         


        
3条回答
  •  臣服心动
    2020-12-19 18:37

    If you have custom initialization work to do, override the no-arg init() method, and forget about init(ServletConfig). Is it ok to call getServletConfig() method inside the no-arg init() method? Yes, an instance of ServletConfig has already been saved by superclass GenericServlet.

    http://javahowto.blogspot.com/2006/06/common-mistake-in-servlet-init-methods.html

    It is always good to use packages for classes. It enables clear demarcation.

提交回复
热议问题