I want to redirect JSP page from one servlet.
All JSP pages are under Web Content
. not under Web-INF
.
I have a problem of calling that JSP pages. I got 404 errors. problem with path.
How can I call jsp pages under Web Content?
ServletContext context = getServletContext();
RequestDispatcher dispatcher = context.getRequestDispatcher("/thankYou.jsp");
dispatcher.forward(request,response);
Thanks ahead.
PROBLEM SOLVED !
I solved the problem using RequestDispatcher
like this:
RequestDispatcher requestDispatcher;
requestDispatcher = request.getRequestDispatcher("/thankYou.jsp");
requestDispatcher.forward(request, response);
A slightly cleaner way to write this code is:
request.getRequestDispatcher("/thankyou.jsp").forward(request, response);
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