• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to forward request to a servlet in other application

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic