A programming method for configuring Web. Xml

Source: Internet
Author: User

Configuring Web. XML for any JAVA/J2EE using programming methods

Introduction
this articleIntroductiontheJavaand theThe EE projectUseanya programming methodof theWeb. XMLConfiguration


Background
As a traditional approach, the configuration of any servlet context and other listeners in Java and EE Web applications is configured in the. xml file.
In contrast, the Servlet 3 introduction is intended to provide a practical way to configure entries for the Web. Xml.


Any servlet 3 based Web application can implement a Servletcontainerinitializer interface that explicitly passes ServletContext at run time as a container.
This can be used to configure Servlets, listeners, any filters, and others that need to be configured by the Web. xml file.


The advanced Spring Framework is more than 3.1 and is implemented more easily because it provides servletcontainerinitializer called Springservletcontainerinitializer implementations.
Basically, in the Spring Web module file It will be implemented through this/service/Java.servlet.servletcontainerinitializer.
At the same time, configuring the servlet context listeners, tasks, and filters will be delegated to another interface called Webapplicationinitializer.
The only task for developers is to implement Webapplicationinitializer and implement configuration servlet contexts.


Let's look at an example of how to implement the same as a typical configuration.

Hand-hit translation, please click Read the original

More Java,java learning, Java face Test http://techfoxbbs.com

A programming method for configuring Web. Xml

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.