I created a folder named jsp in WEB-INF & putting all the .jsp files in this folder. I changed the web.xml
It's giving HTTP Status 404 /JasperPjt/jsp/Login.jsp Not found
.
Please help me out.
I created a folder named jsp in WEB-INF & putting all the .jsp files in this folder. I changed the web.xml
It's giving HTTP Status 404 /JasperPjt/jsp/Login.jsp Not found
.
Please help me out.
The main purpose of putting JSP files in WEB-INF directory is that it will be accessible from the server only, not from client end.(Client will not be able to know the exact URL of file).
If you try to call that file(Files in WEB-INF), server will return HTTP 404.
Just call servlet and then you can call that JSP file like :
request.getRequestDispatcher("/WEB-INF/TargetJspFile.jsp").forward(request, response);
You will not be able to access files inside WEB-INF by default. Generally all the jsps and other UI contents should be organized under your application root directory and outside WEB-INF. Probably you can have MyApp/pages
which cotains your jsps and MyApp/WEB-INF
separately.
You can't access .jps files under WEB-INF folder you can access .jsp under Webcontent folder and its the root folder for all UI and other UI related files.
If your seperating them then you need get the conetxt path from that you can access.
the actual structure is:
HelloWorld
|
---->src
|
---->wecontent
|
----->WEB-INF
|
----->index.jsp
if your seperating
HelloWorld
|
---->src
|
---->wecontent
|
----->WEB-INF
|
----->jsps
|
|---> login.jsp
|---> welcome.jsp
like this now you need to get like this in jsp
<% String path = request.getContextPath(); %>
<a href="<%= path %>/jps/welcome.jsp">Wecome</a>
You could create a public accessible JSP e.g. as yourproject/web/login.jsp
and link your private JSP yourproject/web/WEB-INF/pages/somesnippet.jsp
with this code:
<%@ include file="/WEB-INF/pages/somesnippet.jsp" %>
You cannot directly access files from WEB-INF Folder. You need to either redirect or forward request to it.
If you are redirecting or forwarding and then getting this error then,
/JasperPjt/WEB-INF/jsp/Login.jsp
or I think
/WEB-INF/jsp/Login.jsp
or WEB-INF/jsp/Login.jsp
This should also work.