File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes RequestDispatcher not working..... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "RequestDispatcher not working..... " Watch "RequestDispatcher not working..... " New topic

RequestDispatcher not working.....

Raul Martinez

Joined: Mar 01, 2004
Posts: 17
RequestDispatcher didn't work (for me.) I have a servlet that accepts GET/POST
parameter called doorId and based on that doorID.. the servlet (WebGate) must forward the request
to a specific JSP file under the WebGate Doors (see below).
If I type the servlet
should have forward the request to door1.jsp (see below). But Tomcat display a 404 error

Tomcat said:
HTTP Status 404 - /testbed/jspTest/WebGate/doors/door1.jsp
type Status report
message /testbed/jspTest/WebGate/doors/door1.jsp
description The requested resource (/testbed/jspTest/WebGate/doors/door1.jsp) is not available.
But /testbed/jspTest/WebGate/doors/door1.jsp actually exists...

My Development Environment:
WebGate Doors: /testbed/WebGate/doors/
Available files under /testbed/WebGate/doors/

-rw-r--r-- 1 root root 85 Mar 12 15:26 door1.jsp
-rw-r--r-- 1 root root 85 Mar 12 15:26 door2.jsp
-rw-r--r-- 1 root root 85 Mar 12 15:26 door3.jsp
-rw-r--r-- 1 root root 85 Mar 12 15:26 door4.jsp
-rw-r--r-- 1 root root 106 Mar 12 15:27 doorCATC.jsp

Learning new things, I LIKE!<p>---certification---<br />none so far, experience (considerable, yeah)
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

You dont need to give context name testbed as the part of forward URL.

Raul Martinez

Joined: Mar 01, 2004
Posts: 17
it worked!! Yehey! thank you very much! Duke
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Since the RequestDispatcher is relative to the context, so when you do the forward, the root is already the context, and you just need to give the remaining path for forwarding.

SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Raul Martinez

Joined: Mar 01, 2004
Posts: 17
thanks! got it.
I agree. Here's the link:
subject: RequestDispatcher not working.....
It's not a secret anymore!