If I have a servlet I am able to forward to a jsp in the WebContent folder with no issues:
request.getRequestDispatcher("page.jsp").forward(request, response);
request being an HttpServletRequest and response being an HttpServletResponse.
Now for the question:
What if I want to use package by feature? That is, move page.jsp into the same package as my servlet class so that all the files for one “feature” are in the same place. Is this possible?
If you have a servlet class ‘MyServlet ‘in a package foo, then it would be available in WEB-INF/classes/foo/MyServlet. Now if you want to have JSP in the same package, you need to have the JSP in the folder /WEB-INF/classes/foo/page.jsp. Then you can forward to the JSP like,