In my JSP page I want the links to forward to another JSP page. When the user is on the home.jsp I want them to go to login.jsp etc. The problem I am having is that the JSP can't be found except when i put the pages in the project folder (above the WEB-INF folder).
I tried these lines of code, but none worked:
<a href="/enq/WEB-INF/pages/login.jsp">
<a href="/WEB-INF/pages/login.jsp">
<a href="/pages/login.jsp">
It is only working with the JSP pages in the project folder and then I use the next line:
<a href="login.jsp">
But I want the JSP pages to be in: WEB-INF/pages/
I have solved it, I have created 4 Servlets for each JSP page. Every servlet forwards the message to the corresponding JSP like this:
request.getRequestDispatcher("/WEB-INF/pages/enquette.jsp").forward(request, response);
And in the JSP page in between the a href :
<a href="/enq/enquette">
The web XML:
<servlet-mapping>
<servlet-name>Enquette</servlet-name>
<url-pattern>/enquette</url-pattern>
<a href="/pages/login.jsp">
It must work properly. What HTTP status do you get in this case?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With