Link from html to jsp

In a 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 also have a 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 page hierarchy is a snapshot -

enter image description here

When I click the link in default.html, I get an error

- HTTP Status 404 - 

--------------------------------------------------------------------------------

type Status report

message 

description The requested resource () is not available.
+5
source share
2 answers

Files in a folder are /WEB-INFinaccessible to the public without using the front servlet controller or a specific tag, such as <jsp:include>that executes either RequestDispatcher#forward()or RequestDispatcher#include().

If you need to access the JSP file directly at the URL, you should not place the JSP in the folder /WEB-INF. Put it outside the folder/WEB-INF

WebContent
 |-- forms
 |    |-- CreateNewCustomer.html
 |    |-- CustomerMenu.html
 |    `-- CustomerMenu.jsp
 |-- WEB-INF
 :    :

and fix the link accordingly.

<a href="forms/CustomerMenu.jsp">Test new</a>
+10
source

WEB-INF . jsp WEB-INF, jsp.

+1

All Articles