This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!

Thabiso Motswagole

Greenhorn
+ Follow
since May 16, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Thabiso Motswagole

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
```
response.sendRedirect("//admin/monster-html/admin.jsp");return;
```
this got me to a 404 error page
```
response.sendRedirect("/admin/monster-html/admin.jsp");return;
```

Ialso tried jsp mapping

```
<servlet>
       <servlet-name>admin</servlet-name>
       <jsp-file>/admin/monster-html/admin.jsp</jsp-file>
   </servlet>
   <servlet-mapping>
       <servlet-name>admin</servlet-name>
       <url-pattern>/admin</url-pattern>
   </servlet-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.
3 months ago
JSP