I'm curious how can springMVC mapping to /*
I tried my example, one servlet which mapping to "/*" just render one jsp page "/WEB-INF/jsps/hello.jsp"
and the java code is:Code:<servlet> <servlet-name>helloServlet</servlet-name> <servlet-class>my.HelloServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>helloServlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping>
but this will failed with infinite loopCode:public class HelloServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response){ request.getRequestDispatcher("/WEB-INF/jsps/hello.jsp").forward(request, response); } }
Since the helloServlet mapping to /*, it will also catch the requestDispatcher's forward and cause the infinitely loop.
How do springMVC resolve this issue?




Reply With Quote
