JSP built-in object -- config

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.