File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Servlet method call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet method call" Watch "Servlet method call" New topic

Servlet method call

Yatendra Varshney

Joined: Jan 30, 2006
Posts: 5
suppose there is a method defined in servlet A and I want to call this method in servlet B.
Yatendra Varshney

Joined: Jan 30, 2006
Posts: 5
Please tell me if have any solution.

Thanks in advance.

sven studde
Ranch Hand

Joined: Sep 26, 2006
Posts: 148
1) Declare the method as static in A, then in B use the class name 'A' to call the method?

2) Declare the method as a regular method in A, and then inside B create an A object and use it to call the method?
[ October 30, 2006: Message edited by: sven studde ]
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

or You can call the public method of Servlet A by calling Servlet A inside Servlet B.

please follow this link for more help
Example of Calling Servlets from Servlets

[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Yatendra Varshney

Joined: Jan 30, 2006
Posts: 5
Thanks Saif to clear picture to me.

- Yatendra
subject: Servlet method call
Similar Threads
destroy() method of servlet.
can we call destroy method in servlet service method?
how to pass data from view to model?
how to call destroy() method ?