config.getInitParameter always return null

前端 未结 5 1131
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-12 18:40

Why does config.getInitParameter(String) always return null in the following code example?

public void init(ServletConfig config) t         


        
5条回答
  •  离开以前
    2021-01-12 19:21

    It's never a good idea to override the init(config) method. Instead use the provided init() convenience method and do a getServletConfig() to get the configuration parameters:

    http://docs.oracle.com/javaee/1.2.1/api/javax/servlet/GenericServlet.html#init() http://docs.oracle.com/javaee/1.2.1/api/javax/servlet/GenericServlet.html#getServletConfig()

提交回复
热议问题