• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Servlet - Servlet Communication

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

How to do Servlet - Servlet Communication..
How to call a servlet from a servlet
Please help me .........

 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to do Servlet - Servlet Communication..
How to call a servlet from a servlet


These are two quite different questions. I hope you were expecting different answers.

To communicate between servlets you typically use the "application context" ( returned by getServletContext() ). Any objects placed as attributes in this context will be visible to all servlets and JSPs in an application.

To call a servlet from another servlet is more complex to answer. It largely depends whet you mean by "call a servlet". You can return an HTTP page to the browser which makes a redirect request to the new servlet, you can use a client API (I usually use HTTPUnit, but there are plenty of others) to make an HTTP call to the other servlet. You can forward the current HTTP request to the other servlet by obtaining a RequestDispatcher, etc..

Can you explain a bit more about what you want to do with this?
 
Let nothing stop you! Not even this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic