Dylan Klomparens
Dylan Klomparens

Reputation: 2932

Using JSP, is the deployment descriptor (web.xml) obsolete?

I should preface this question by saying that I am new to JavaServer Pages. I have been researching the purpose and use of the deployment descriptor (commonly referred to as web.xml). I found this document which says that some Java annotations can be used to describe things that would typically be put in the deployment descriptor. So, my question is:

  1. Using the latest version of JSP, is it possible to only use annotations to describe what would otherwise go in the deployment descriptor?

Upvotes: 0

Views: 498

Answers (1)

atrain
atrain

Reputation: 9255

That is sort of the point. Rather than using web.xml, you would annotate your classes that fulfill those various functions. A Servlet would be annotated with @WebServlet, a Filter with @WebFilter, etc.

Here's a good article: http://www.servletworld.com/servlet-tutorials/servlet3/new-features.html

Note that this is a common trend in Java EE - the move away from XML configuration to annotations. Spring, for example, is following this trend with the v3.1 introduction of @Configuration classes which can take the place of XML config files.

Upvotes: 2

Related Questions