link from html to jsp
29,852
Solution 1
Files in /WEB-INF
folder are not publicly accessible without using a front controller servlet or a specific tag like <jsp:include>
which does either a RequestDispatcher#forward()
or RequestDispatcher#include()
.
If you need to access a JSP file directly by URL, then you should not be placing the JSP in /WEB-INF
folder. Put it outside the /WEB-INF
folder
WebContent
|-- forms
| |-- CreateNewCustomer.html
| |-- CustomerMenu.html
| `-- CustomerMenu.jsp
|-- WEB-INF
: :
and fix the link accordingly.
<a href="forms/CustomerMenu.jsp">Test new</a>
Solution 2
WEB-INF
folder is not accessible outside.
You will either need to move the jsp outside of WEB-INF
or use forward request to forward to the jsp.
Comments
-
URL87 almost 2 years
In dynamic Web Project I have - default.html page
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="stylesheet" href="./Styles/Site.css" type="text/css" /> <title>Create new customer</title> </head> <body> <a href="\WEB-INF\forms\CustomerMenu.jsp">Test new</a> </body> </html>
I have also the CustomerMenu.jsp page -
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="stylesheet" href="./Styles/Site.css" type="text/css" /> <title>Create new customer</title> </head> <body> // Table .. </body> </html>
The pages hierarchy is as the snapshot -
When I press on the link in default.html I get error message
- HTTP Status 404 - -------------------------------------------------------------------------------- type Status report message description The requested resource () is not available.