File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher not working.....

 
Raul Martinez
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 http://192.168.1.11:8080/testbed/servlet/test.WebGate?doorId=1 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.
[/QUOTE>
But /testbed/jspTest/WebGate/doors/door1.jsp actually exists...

My Development Environment:
APP ROOT: http://192.168.1.11:8080/testbed/
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


 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You dont need to give context name testbed as the part of forward URL.
 
Raul Martinez
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it worked!! Yehey! thank you very much! Duke
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Nick.
 
Raul Martinez
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks! got it.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic