• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
  • Carey Brown
  • salvin francis
  • Claude Moore

How do I get the RequestDispatcher to forward to the desired jsp which is in a seperate folder?  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use requestdispatcher to forward to a jsp inside another folder. None of them are in the WEB-INF folder. The problem is that it will show it redirected as the tab will show the title of the desired page but the url shows that of the servlet and the page is blank.
File system is (all under Web Pages not WEB-INF):

current jsp: Web Pages/index/index.jsp
desired jsp: Web Pages/admin/monster-html/admin.jsp

![picture of problem](https://i.ibb.co/B6K8TZn/Screenshot-14.png)

I tried:

This got me to that page displayed
request.getRequestDispatcher("/admin/monster-html/admin.jsp").forward(request, response);
this got me to an error page
RequestDispatcher requestDispatcher = request.getRequestDispatcher("//admin/monster-html/admin.jsp");
requestDispatcher.forward(request, response);
this too got me to an error page
this got me to a 404 error page

Ialso tried jsp mapping


here is what I have currently
request.setAttribute("projects", projects);
request.setAttribute("sme_pending", sme_pending);
request.setAttribute("complaints", complaints);
request.setAttribute("freelancers_pending", freelancers_pending);

RequestDispatcher requestDispatcher = request.getRequestDispatcher("/admin/monster-html/admin.jsp");
requestDispatcher.forward(request, response);

I want to call the admin.jsp and use the request too.
Those cherries would go best on cherry cheesecake. Don't put those cherries on this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!