The Config object indicates the current JSP configuration information, but the JSP page usually does not need to be configured, so there is no configuration information. This object is rarely used on JSP pages, but the user is large in servlet, because servlet needs to be configured in the web. xml file, you can specify the configuration parameters.
The Config object is an instance of servletconfig. getinitparameter (string paramname) is used to obtain the configuration parameters ).
Configuring JSP is also on the web. in the XML file, JSP is configured as a servlet, And the init-Param element is used for servlet configuration parameters. This element can accept two sub-elements: param-name And param-value.
<Servlet>
<! -- Specify the servlet name -->
<Servlet-Name> config </servlet-Name>
<! -- Specify the page to configure servlet -->
<JSP-File>/xxxx. jsp </JSP-File>
<Init-param>
<Param-Name> name </param-Name>
<Param-value> value </param-value>
</Init-param>
</Servlet>
<Servlet-mapping>
<! -- Specify config servlet configuration to/config path -->
<Servlet-Name> config </servlet-Name>
<URL-pattern> config </url-pattern>
</Servlet-mapping>
Note: If you want the JSP page to obtain the web. the information in the XML configuration file must be accessed through the JSP configuration path, because only such access to the JSP page will make the configuration parameters take effect.