This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi guys, I am just a beginner on servlet, i need to clear one my doubt...
Why do we have servlet name in DD. Why cant we map the class name directly with the URL pattern , the idea is to protect the name of the class file from the client.....then what is need for adding the extra layer of mapping (SERVLET NAME) between the url pattern and servlet class
A servlet can either be a Java class or a JSP file.
In addition (and maybe more importantly) You can have several servlets in service with different names and settings; all from the same class file.
You may want to give each of these two servlets their own mapping. It would be hard to accomplish this if the name weren't abstracted from the Java class. [ December 03, 2008: Message edited by: Ben Souther ]
Ravi, There is one more reason why we use DD.If you use class names in url then the user know about the exact path of class in server,which is normally considered as a security threat.So we map the particular url pattern to a class.Hence,the user(in client side) doesn't know about servlet path which doesnt need to him.