wood burning stoves 2.0*
The moose likes Servlets and the fly likes Basic Servlet Questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Basic Servlet Questions" Watch "Basic Servlet Questions" New topic
Author

Basic Servlet Questions

Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Hi All,
I'm new to Servlets.need assistance for the below queries.

1> Can we create a Servlet without init() and destroy() methods ?if so,will the servlet run without errors ?
2> how do 2 web servers communicate with each other?

--
Deepak Lal


When The Going Gets Tougher,The Tougher gets Going
Praveen Kumar
Ranch Hand

Joined: Nov 06, 2006
Posts: 133
Hi Deepak,


we should have init() to create and destroy() to destroy the servlet.

According Servlet specification we should have.

But Containers will take care of this things.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29249
    
139

Deepak,
1) HttpServlet (or more precisely, its superclass), implement init and destroy. You only need to override them if you have something specific that needs to be done. Init is useful for initializing configuration parameters and the like. I've never had cause to override destroy.

2) Web servers don't communicate with each other directly. A client (browser) makes requests to both and the client combines the information into a web page.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Basic Servlet Questions
 
Similar Threads
Help Tomcat5.5.7: Error in catalina
Is there a way to Invoke a Servlet without having any Servlet Mapping Data in web.xml
error
Servlet tag
servlet-mapping