Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Servlets and the fly likes Proces a servlet inside another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Proces a servlet inside another" Watch "Proces a servlet inside another" New topic
Author

Proces a servlet inside another

Yash Sharma
Ranch Hand

Joined: Jan 30, 2003
Posts: 61
I have a servlet that must call another servlet, read its response and run a database query based on that response. How do I do that? I know of sendRedirect() and RequestDispatcher's methods but they would transfer control to this second servlet which I don't want.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Whenever I want to call another web application from Java I use HTTPUnit. It's marketed as a web application test framework, but it also contains a neat but powerful way to send stuff to remote web apps and read the result in a useful way.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
Also, couldn't you try and wrap the url to your servlet in a java.net.URL, and then return the InputStream from the java.net.URLConnection object.
Craig.
danny liu
Ranch Hand

Joined: Jan 22, 2004
Posts: 185
How about using a filter?
Dan
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
How about using a filter?
Umm, I'm having trouble seeing how using a filter might be at all helpful in this case. Can you give any more details of your solution idea?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Proces a servlet inside another
 
Similar Threads
ejb for server to erver communication
servlet
Ajax and servlet problem
redirection to remote servlet
Call Servlet from Servlet - not response.sendRedirect()