This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes instantiating a servlet from another servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "instantiating a servlet from another servlet" Watch "instantiating a servlet from another servlet" New topic
Author

instantiating a servlet from another servlet

Ulvi Cetin
Ranch Hand

Joined: Mar 03, 2003
Posts: 39
I have a method in a servlet and want to invoke it form another. Any ideas how can this be done?

Thx.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60748
    
  65

That way lies grief. It'd be best to factor the common code out of the first servlet so that it can be more easily reused across multiple servlets. Probably the best way to do this would be to create an abstract servlet class containing the common code that both your servlets could extend.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Consider Paul's rocket mass heater.
 
subject: instantiating a servlet from another servlet
 
Similar Threads
Can a servlet be embedded in another servlet?
can one servlet extend another servlet?
Servlet Calling?
Accessing servlet
one servlet calling another servlet