Hi ranchers, I don't understand why the getInitParameter(String name) and getInitParameterNames() are on both ServletConfig and ServletContext interfaces. Also, if the HttpServlet extend Generic Servlet that implement StervletConfig why have a method on the HttpServlet to getServletConfig()? Why is there such redundancy? Thanks, Aruna.
ServletConfig (only meant for a servlet) and ServletContext (meant for the whole web app) have different initialization parameters. So both need to have their own getInitParameter() method. getServletConfig() method is declared in the Servlet interface therefore anybody (and thus GenericServlet also) who implements that interface has to define it. However, ServletConfig is an interface. So to provide a simple implementation of it, they've made GenericServlet implement it. This is just for the ease of the developers. They could as well have another class say GenericServletConfig that could provide simple implementation of ServletConfig. HTH, Paul.