Can we have Servlet Constructor?

Yes, you can have as per rule. It is executed even before init(). Then why generally we avoid constructor in Servlets. First let us write one simple example and see it is true or not; then we will go into details. Example on Servlet Constructor import javax.servlet.ServletException; import javax.servlet.http.*; import java.io.*; public class ConstructorServlet extends …

Can we have Servlet Constructor? Read More »