| Author |
Why there is a seperation between configuring and Mapping a servlet in the web.xml file?
|
rajesh uppiliappan
Greenhorn
Joined: Nov 07, 2012
Posts: 1
|
|
Why we configure and Map servlets separately using the <servlet> and <servlet-mapping> tags.
for eg.
instead we can do like
what is the reason behind this seperation?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
|
There can be more than one mapping for any servlet.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Stefan Evans
Bartender
Joined: Jul 06, 2005
Posts: 1004
|
|
Separation of concerns.
DRY (don't repeat yourself)
probably a few other programming guidelines could be applied, but those are the main two.
There are two distinct concepts here.
1 - "Servlet" defines a module that can handle a request, and gives a response
2 - "Servlet-mapping" tells the container "which servlet should I invoke when the user calls this URL"
|
 |
 |
|
|
subject: Why there is a seperation between configuring and Mapping a servlet in the web.xml file?
|
|
|