Answer the question
In order to leave comments, you need to log in
J2EE - what's the difference in servlet mapping URL regexes?
What's the difference between
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Answer the question
In order to leave comments, you need to log in
Both options designate a default servlet. The difference is what data the HttpServletRequest will contain.
In the first case, HttpServletRequest.getServletPath() will return the path to the servlet, and HttpServletRequest.getPathInfo() will return null.
In the second case, getServletPath() will be empty and getPathInfo() will contain the path to the resource.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question