A Developer's Diary

Showing posts with label Servlet. Show all posts
Showing posts with label Servlet. Show all posts

Oct 26, 2012

A Servlet Refresher

A Servlet is a dynamic web component developed in Java technology, loaded and run by Java technology enabled web server. The Servlet interface is the core of the Java Servlet API. The two classes which implement the Servlet interface are the GenericServlet and the HttpServlet. The Servlet interface defines the init(), service() and the destroy() methods which are implemented by GenericServlet class. The HttpServlet is an abstract class extending GenericServlet and basically helps in processing HTTP requests.

Servlet Life Cycle
The Servlet life cycle is expressed in the API by the init, service and destroy methods of the Servlet interface

Read more ...

Oct 22, 2012

Configuring and retrieving a DataSource object

In the JDBC API, a DataSource object is a means to access a database. A DataSource object is identified by set of properties which is used to communicate with the server. These properties include information such as the location of the database server, the name of the database, the protocol used to communicate with the server, the username and password of the privileged database user.
In the application server, a data source is known as JDBC Resource

The rest of the post demonstrates how to configure a JDBC Resource in GlassFish application server and retrieve the same data source using JNDI through a simple web servlet

Read more ...