Proces a servlet inside another

Yash Sharma

Ranch Hand

Posts: 61

posted 13 years ago

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

Posts: 6920

posted 13 years ago

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.