aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet method call" Watch "Servlet method call" New topic
Author

Servlet method call

Yatendra Varshney
Greenhorn

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
Greenhorn

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

Thanks in advance.

Regrad,
Yatendra
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


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

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

- Yatendra
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Servlet method call