Skip to main content

Posts

Showing posts with the label Java programming

Overview of Servlet Methods

Servlet Methods Overview Overview of Servlet Methods A Generic servlet contains the following five methods: init() public void init(ServletConfig config) throws ServletException The init() method is called only once by the servlet container throughout the life of a servlet. This method allows the servlet to initialize and be placed into service. The servlet cannot be put into service if: The init() method does not return within a fixed time set by the web server. It throws a ServletException. Parameters: The init() method takes a ServletConfig object containing initialization parameters and servlet configuration and throws a ServletException if an exception occurs. service() public void service(ServletRequest req, ServletResponse res) throws ServletExceptio