Can anyone tell me what is the difference between / and / * in the mapping of the servlet?

advertisements

This question already has an answer here:

  • Difference between / and /* in servlet mapping url pattern 5 answers

we can define a servlet in web.xml and specify the url-pattern, I often specify the url-pattern into "/*", but in Spring MVC,it‘s value is "/",if I use "/*", I even couldn't visit the welcome file,so any one could tell me what the difference between / and /* , thank you


As pointed by Mohamed the issue may be elesewhere. Generally speaking

  1. / means exactly http://localhost/
  2. /* means http://localhost/<whatever>

the question must be a little bit refined, if you are configuring org.springframework.web.servlet.DispatcherServlet a typical pattern should be *.do or you cannot access pure html page.