I have a jsp located in the /package
directory.
Then I map my servlet with a WebServlet Annotation of "/package/*"
.
In my servlet, I forward the request to a jsp in the above directory:
RequestDispatcher dispatcher =
request.getServletContext().getRequestDispatcher("/package/some_file.jsp");
dispatcher.forward(request, response);
This causes a StackOverflowError:
org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for servlet SomeServlet threw exception
I can easily fix this by changing the name of the jsp folder to something else (eg: package_files
). But I don't understand why this is necessary because I thought the servlets and the jsp folders were in entirely different locations (specifically, the servlet is in /web/WEB-INF/classes/package
while the jsp is in /web/package
.
Am I mistaken, or is there something wrong with my setup?
Thank you.