javajspservletsweb-inf

How to access a jsp page inside a folder under WEB-INF?


I'm learning about servlets and JSP and I try to make an app. The app is from this page

This is the structure of the app:

enter image description here

And I put all the JSP in WEB-INF:

enter image description here

When I try to run any jsp it's not working, I get this error: HTTP Status 404 – Not Found... Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

If I move the jsp in WebContent the app is working succesfully. But I want to keep the jsp in WEB-INF. What should I do? Thanks in advance!


Solution

  • Seems i got your problem. If you have servlet class write code to forward to jsp page like this. Because you have put your jsp page inside WEB-INF/view

    request.getRequestDispatcher("/WEB-INF/view/homeView.jsp").forward(request, response);