This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Doubt Regarding Web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Doubt Regarding Web.xml" Watch "Doubt Regarding Web.xml" New topic

Doubt Regarding Web.xml

Nittin singla

Joined: Jul 02, 2011
Posts: 24
Suppose i am working on some large application including thousands of servlets. Do i need to write each of these in the Deployment Descriptor file(Web.xml)?? Isnt there some shortcut to it?
Martyn Clark
Ranch Hand

Joined: Apr 16, 2005
Posts: 108
Which version of Servlets are you using if you use 3.0 you can configure mappings with annotations :-)

Martyn...<br /> <br />SCJP 1.4 SCWCD 1.4
Nittin singla

Joined: Jul 02, 2011
Posts: 24
No...I am using the older version...
elvadas nono

Joined: Jul 04, 2011
Posts: 12
Oups, I think with older version you should put all sevlet instances that the container should load in the deployment descriptors.
With servlet 3.0 API you can use Annotations, Web Fragments to reduce web.xml size,
you can also add servlet programmatically using new feartures of servletContext addServlet( String name, String class) etc..
Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3476

A better solution could be using a MVC web framework like Struts2, Spring MVC, Stripes or FrontMan.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60789

Please read this article for information on a patter that can help.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Doubt Regarding Web.xml
Similar Threads
Problems with Tomcat & Struts
where to start..
is sibling elements in web.xml ordered?
An Error Occured while starting tomcat
can anyone give me the session time out example code