JSP Built-in objects----config__jsp

Source: Internet
Author: User

Config object represents 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 less used on JSP pages, but is larger in the servlet because the servlet needs to be configured in the Web.xml file to specify configuration parameters.

The Config object is an instance of ServletConfig that is used to obtain configuration parameters by Getinitparameter (String paramname).

The configuration JSP is also done in the Web.xml file, the JSP is configured as a servlet, and the Init-param element is used for the servlet configuration parameter, which can accept param-name and param-value two child elements.

<servlet>

<!--Specify the name of the servlet-->

<servlet-name>config</servlet-name>

<!--Specifies that the page is configured servlet-->

<jsp-file>/xxxx.jsp</jsp-file>

<init-param>

<param-name>name</param-name>

<param-value>value</param-value>

</init-param>

</servlet>


<servlet-mapping>

<!--specifies that the config servlet be configured to the/config path-->

<servlet-name>config</servlet-name>

<url-pattern>config</url-pattern>

</servlet-mapping>


Note: If you want the JSP page to get the information in the Web.xml configuration file, you must access the page by configuring the path for the JSP, because the only way to access the JSP page is to make the configuration parameters work.

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.