I was reading Head First JSP and Servlets book. I was going through the mapping of servlet. And my doubt here is
<
On the above questions i could find answer for one of the questions.
What happens if the url-pattern do not start with forward slash(/). I have checked it but i don't remember
When i started tomcat by removing the / in the url-pattern i got the following error
Caused by: java.lang.IllegalArgumentException: Invalid ServletBeer.do in servlet mapping
at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3267)
at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3242)
at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1324)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1348)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:880)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:378)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5343)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
This indicates that if we are not using extension mapping compulsory the url-pattern should start with /