File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How to forward request to a servlet in other application Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "How to forward request to a servlet in other application" Watch "How to forward request to a servlet in other application" New topic
Author

How to forward request to a servlet in other application

megha ghanekar
Greenhorn

Joined: Mar 15, 2006
Posts: 17
Hello Everyone!!!
I have 2 web applications Demo1 & Demo2.
In Demo1 I have a servlet First. & in Demo2 I have a servlet second.
I want to forward the request from Demo1 applications First servlet to Demo2 applications second servlet.
Can anyone help me out?
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4967

You want to forward the request, or do you just want to invoke the second Servlet?

What is it about the request object that needs to be passed to the second web application? A parameter? An input field.

Remember, web modules are logically separated for a reason. A separate web module could be on a remote server just as easily as it could be on a local server. If there's a total need to forward the actual request, maybe the two servlets should be in the same war file.

But you can simply invoke the second Servlet from the first Servlet. That's possible.

-Cameron


Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
Rajesh Pitty
Greenhorn

Joined: Jan 27, 2005
Posts: 9
Meghna ,
lets say you have two Webapps Demo1(context url is "/Demo1")
and Demo2("/Demo2")
and each one has one servlet DemoServlet1(in Demo1) and DemoServlet2 (in Demo2)

if you want pass a request from DemoServlet1 to DemoServlet2
try this code


Rajesh<br /><a href="http://www.rajeshpg.com" target="_blank" rel="nofollow">www.rajeshpg.com</a>
 
I agree. Here's the link: http://jrebel.com/download
 
subject: How to forward request to a servlet in other application
 
Similar Threads
Getting values from id attribute in a servlet
Hibernate Commnication between two database
Class loading hierrarchy
i need help
static block