Archive

Posts Tagged ‘Servlet’

Configure Hibernate for Java Servlet Application

August 2nd, 2010 Touna No comments

Hibernate, a power ORM tool. From an object-oriented perspective, persistence actually can be considered an extension of an object’s lifecycle. a minor part of the software, as compared with the whole domain. Thus, a programmer who relies on a DBMS should not focus mainly on persistence, because DBMSs are complex entities with their own constraints, rules and protocols that the programmer needs to follow. In order to follow DBMS constraints, rules and protocols, programmers, even object-oriented programmers are tempted to put their main focus on the database technology and persistence and start performing data processing. Read more…

Categories: Java Tags: , ,

Servlet Interview Question

July 13th, 2010 Touna No comments

Q: Explain the life cycle methods of a Servlet.

A: The javax.servlet.Servlet interface defines the tree methods known as life-cycle method.

public void init(ServletConfig config) throws ServletException

public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException

public void destroy()

First the servlet is constructed, then initialized with the init()method.

Any request from client are handled initially by the service() method before delegating to the doXxx() methods in the case of HttpServlet.

The servlet is removed from service, destroyed with the destroy() method, then garbaged collected and finalized.

Categories: Java Tags: ,

Powered by WP Robot