I am experimenting with Servlet+JSP MVC model, but can't understand where I am wrong.
My first try is a "catch-all" @WebServlet which should act as a "router" for all requests:
@WebServlet( urlPatterns = {"/*"} )
public class RoutingServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
System.out.println(req.getPathInfo());
req.getRequestDispatcher("index.jsp").forward(req, res);
}
}
This gives me a StackOverflowError.
How can I make the servlet "exclude" .jsp from its catch-all ?