Servlet configuration-related elements in Web. xml

Source: Internet
Author: User

<Servlet>
<Servlet-Name> helloworld </servlet-Name>
<Servlet-class> helloworld </servlet-class>
<Init-param>
<Param-Name> param1 </param-Name>
<Param-value> param1value </param-value>
</Init-param>
<Run-as>
<Description> security role for anonymous access </description>
<Role-Name> Tomcat </role-Name>
</Run-as>
</Servlet>
<Servlet-mapping>
<Servlet-Name> Snoop </servlet-Name>
<URL-pattern>/snoop </url-pattern>
</Servlet-mapping>

<Load-on-startup> 1 </load-on-startup>
Element description:
<Servlet> </servlet> is used to declare the data of a servlet, mainly including the following sub-elements:
<Servlet-Name> </servlet-Name> specifies the servlet name.
<Servlet-class> </servlet-class> specifies the servlet class name.
<JSP-File> </JSP-File> specifies the complete path of a JSP page on the web platform.
<Init-param> </init-param> is used to define parameters. Multiple init-Param parameters are allowed. Access the initialization parameters through the getinitparamenter (string name) method in the servlet class.
<Load-on-startup> </load-on-startup> specifies the servlet loading sequence when the web application starts.
When the value is positive or zero: The servlet container first loads the servlet with a small value, and then loads the servlet with a large value in sequence.
The value is negative or undefined: The servlet container will load it when the Web Client first accesses this servlet.
<Servlet-mapping> </servlet-mapping> defines the URL of the servlet, which contains two child elements.
<Servlet-Name> </servlet-Name> specifies the servlet name.
<URL-pattern> </url-pattern> specifies the URL of the servlet.

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.