404 simply means “Not Found”.
Either the URL is wrong (note: case sensitive!), or the resource is not there where you think it is.
Just verify the URL and/or verify if the resource is there where you’d expect it to be. You placed sample.jsp
in /WEB-INF
folder. This way it is not publicly accessible without calling through a front controller servlet.
Put it outside /WEB-INF
.
samplejsp
`-- WebContent
|-- WEB-INF
`-- sample.jsp
If you want to keep it in /WEB-INF
, then you need to create a front controller servlet which forwards to it in doGet()
method as below.
request.getRequestDispatcher("/WEB-INF/sample.jsp").forward(request, response);
Finally “open” the JSP by just calling servlet’s actual URL instead of JSP’s fictive URL.