aspose file tools*
The moose likes Servlets and the fly likes How to Forward a request to another Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to Forward a request to another Servlet" Watch "How to Forward a request to another Servlet" New topic
Author

How to Forward a request to another Servlet

Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
I am specifying the full path to the target servlet class "Test" from another servlet class.




But I am getting Http 404 error stating The requested resource (/content-type-ex/WEB-INF/classes/com/example/posr/Test) is not available.

Whats wrong with this?


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Keith Pitty
Ranch Hand

Joined: Sep 22, 2005
Posts: 32
You need to specify the servlet mapping in the argument of getRequestDispatcher.
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Thanks

Its actually the <url-pattern> element value of the <servlet-mapping> that has to be specified as argument to getRequestDispatcher(String path) method.
Keith Pitty
Ranch Hand

Joined: Sep 22, 2005
Posts: 32
Yes, to be exact it is the url-pattern of the servlet mapping. Did that fix your problem?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Forward a request to another Servlet