You are on page 1of 296

WEB TECHNOLOGIES

PRASAD B
Assoc. Prof.
Dept. of Computer and Engineering
Email: bprasad@mlritm.ac.in

PALLAVI
AssT. Prof.
Dept. of Computer and Engineering
Email: pallavi_kkreddy@mlritm.ac.in
UNIT - 3
Objective

• To introduce Server side programming with Java


Servlets and JSP

Email: bprasad@mlritm.ac.in
UNIT - 3

Scope

• Servlets plays an important role in many different IT systems.

• Servlets is often used for distributing data over the Internet.

• It is important (for all types of software developers!) to have a

good understanding of servlets

Email: bprasad@mlritm.ac.in
UNIT – 3
Course Outcomes

• Gain Knowledge on how to write a simple applications with


technologies like HTML, PHP, XML, JavaScript, AJAX, Servlets
and JSPs.
• Able to write a server side java application called Servlet to
catch form data sent from client, process it and store it on
database

Email: bprasad@mlritm.ac.in
UNIT - 3

SERVLETS
Client - Server Model

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
Client Server Architecture

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
Client Server Architecture
of the Internet

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
Introduction – Server
1. Web-Server
2. Application-Server

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
Server

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
Web-Server

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
Application-Server

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
HTTP
(Hypertext Transfer Protocol)

1. Requests
2. Responses
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
HTTP - Requests

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
HTTP - Responses

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
HTTP – Methods

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
HTTP Method - POST

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
HTTP Method - PUT

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
HTTP Method - GET

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
HTTP Method - DELETE

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
HTTP Method - HEAD

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
HTTP Method - CONNECT

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
HTTP Method - OPTIONS

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
HTTP Method - TRACE

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
HTTP - Status Codes

PRASAD B, Assoc. prof., Pallavi,


Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
PRASAD B, Assoc. prof., Pallavi,
Asst. Prof, Dept. of CSE,
MLRITM,JNTU-H
UNIT - 3

SERVLETS
SERVLET - Introduction

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Servlet

 Servlet Technology is used to create web applications. 

 Servlet technology uses Java language to create web

applications.

As Servlet Technology uses Java, web applications made using Servlet

are Secured, Scalable and Robust.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
CGI
(Common Gateway Interface)

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
CGI (Common Gateway Interface)

Before Servlets, CGI programming was used to create web applications.


Here's how a CGI program works :

User clicks a link that has URL to a dynamic page instead of a static page.

The URL decides which CGI program to execute.

Web Servers run the CGI program in seperate OS shell. The shell includes OS

enviroment and the process to execute code of the CGI program.

The CGI response is sent back to the Web Server, which wraps the response in

an HTTP response and send it back to the web browser.


PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Drawbacks of CGI programs

 High resposne time because CGI programs execute in their own

OS shell.

 CGI is not scalable.

 CGI programs are not always secure or object-oriented.

 It is Platform dependent.
Because of these disadvantages, developers started looking for better CGI
solutions. And then Sun Microsystems developed Servlet as a solution over
traditional CGI technology.
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Advantages of using Servlets

 Less response time because each request runs in a

separate thread.

 Servlets are scalable.

 Servlets are robust and object oriented.

 Servlets are platform independent.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Servlet Life Cycle

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
How a Servlet Application works

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
UNIT - 3

SERVLETS
Servlet API
https://docs.oracle.com/cd/E17802_01/products/products/servlet/2.1/api/
packages.html

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Servlet API

Servlet API consists of two important packages that

encapsulates all the important classes and interface, namely :

1. javax.servlet

2. javax.servlet.http

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
javax.servlet

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
javax.servlet

 The javax.servlet package contains many interfaces and classes

that are used by the servlet or web container.

 These are not specific to any protocol.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Interfaces in javax.servlet package

There are many interfaces in javax.servlet package. They are as

follows:

1. Servlet

2. ServletConfig

3. ServletContext

4. ServletRequest

5. ServletResponse
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Classes in javax.servlet package

There are many classes in javax.servlet package. They are as

follows:

1. GenericServlet

2. ServletInputStream

3. ServletOutputStream

4. ServletException
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Interface - javax.servlet

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Interface - javax.servlet.servlet

public interface Servlet
 This interface is for developing servlets.

 The Servlet interface defines methods to initialize a servlet, to receive and

respond to client requests, and to destroy a servlet and its resources.

 These are known as life-cycle methods, and are called by the network service in

the following manner:

 Servlet is created then initialized.

 Zero or more service calls from clients are handled

 Servlet is destroyed then garbage collected and finalized


PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Method Description

 init(ServletConfig) Initializes the servlet.

destroy() Cleans up whatever resources are being held (e.g.,


memory, file handles, threads) and makes sure that any
persistent state is synchronized with the servlet's current
in-memory state.

getServletConfig() Returns a servlet config object, which contains any


initialization parameters and startup configuration for
this servlet.

service(ServletRequest, Carries out a single request from the client.


ServletResponse)

getServletInfo() Returns a string containing information about the


PRASAD B, Assoc. prof.,
servlet,MLRITM,JNTU-H
such as its author, version, and copyright.
Interface - javax.servlet.ServletConfig

public interface ServletConfig

 This interface is implemented by services in order to pass

configuration information to a servlet when it is first loaded.

 A service writer implementing this interface must write

methods for the servlet to use to get its initialization

parameters and the context in which it is running.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Method Description

getServletName Returns the name of the servlet.

getInitParameter (String name) Returns the parameter value for the specified
parameter name.

Enumeration Returns an enumeration of all the initialization


getInitParameterNames() parameter names.

ServletContext getServletContext() Returns an object of ServletContext.


Interfaces - javax.servlet.ServletContext

public interface ServletContext

 The ServletContext interface gives servlets access to

information about their environment, and allows them to log

significant events.

 Servlet writers decide what data to log. The interface is

implemented by services, and used by servlets.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Method Description

Object Returns the attribute for the specified name.


getAttribute(String name)

setAttribute(String Sets the given object in the application scope.


name,Object object)

getServerInfo() Returns the name and version of the network


service under which the servlet is running.

log(String) Writes the given message string to the servlet


log file.

getMimeType(String) Returns the mime type of the specified file, or


null if not known.
Interface - javax.servlet.ServletRequest

public interface ServletRequest

 This interface is for getting data from the client to the servlet

for a service request.

 Network service developers implement the ServletRequest interface.

 The methods are then used by servlets when the service method is

executed; the ServletRequest object is passed as an argument to the

service method.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Method Description
getAttribute(String). Returns the value of the named attribute of the request, or null if the attribute
does not exist

getAttributeNames() Returns an enumeration of attribute names contained in this request.

getContentLength() Returns the size of the request entity data, or -1 if not known.

getContentType() Returns the Internet Media Type of the request entity data, or null if not
known.

getInputStream() Returns an input stream for reading binary data in the request body.

getProtocol() Returns the protocol and version of the request as a string of the
form <protocol>/<major version>.<minor version>.

getReader() Returns a buffered reader for reading text in the request body

getServerName() Returns the host name of the server that received the request.

getServerPort() Returns the port number on which this request was received.
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Interface - javax.servlet.ServletResponse

public interface ServletResponse

 This interface helps the servlet to formulate the response for the

clients request.

 Network service developers implement this interface; its methods are

then used by servlets when the service method is run, to return data

to clients.

 The ServletResponse object is passed as an argument to the

service method.
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Method Description

 getCharacterEncoding() Returns the character set encoding used for this


MIME body.

getOutputStream() Returns an output stream for writing binary


response data.

  Returns a print writer for writing formatted text


 getWriter()  responses.
 

setContentLength(int) Sets the content length for this response.


 

setContentType(String) Sets the content type for this response.


PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Classes - javax.servlet

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Class - javax.servlet.GenericServlet
javax.servlet.GenericServlet

 The GenericServlet class implements the Servlet interface and,

the ServletConfig interface.

 The GenericServlet class was created to make writing servlets

easier.

 It provides simple versions of the life-cycle methods init and

destroy, and of the methods in the ServletConfig interface.


PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Method Description

init(ServletConfig config)  is used to initialize the servlet.


void service(ServletRequest provides service for the incoming request. It is invoked at each
request, ServletResponse
time when user requests for a servlet.
response)

destroy()  is invoked only once throughout the life cycle and indicates that
servlet is being destroyed.

getServletConfig()  returns the object of ServletConfig.

getServletInfo()  returns information about servlet such as writer, copyright,


version etc.
init()  it is a convenient method for the servlet programmers, now
there is no need to call super.init(config)

getServletContext()  returns the object of ServletContext.


getInitParameter(String name)  returns the parameter value for the given parameter name.
getInitParameterNames()  returns all the parameters defined in the web.xml file.

getServletName()  returns the name of the servlet object.

log(String msg)  writes the given message in the servlet log file.
PRASAD B, Assoc. prof.,
log(String msg,Throwable t)  writes the explanatory message in the servlet log file and a
MLRITM,JNTU-H
Class - javax.servlet.ServletInputStream

javax.servlet.ServletInputStream

 ServletInputStream class provides stream to read binary data

such as image etc. from the request object. It is an abstract

class.

 The getInputStream() method of ServletRequest interface

returns the instance of ServletInputStream class


PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Method Description
int readLine(byte[] b, int off, int len) it reads the input stream.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Class - javax.servlet.ServletOutputStream

javax.servlet.ServletOutputStream

 ServletOutputStream class provides a stream to write binary

data into the response. It is an abstract class.

 The getOutputStream() method ofServletResponse interface

returns the instance of ServletOutputStream class

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Method Method

void print(char c){} void println(boolean b){}

void print(int i){} void println(char c){}

void print(long l){} void println(int i){}

void print(float f){} void println(long l){}

void print(double d){} void println(float f){}

void print(String s){} void println(double d){}

void println{} void println(String s){}

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Class - javax.servlet.ServletException

public class ServletException

This exception is thrown to indicate a servlet problem.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Method Description

 ServletException() Constructs a new ServletException.

 ServletException(String) Constructs a new ServletException with the specified

  message.

ServletException(String, Constructs a new ServletException with the specified

Throwable) message and root cause

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
 javax.servlet.http

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
 javax.servlet.http

The javax.servlet.http package contains interfaces and classes that

are responsible for http requests only.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Interfaces in javax.servlet.http package

There are many interfaces in javax.servlet.http package. They are

as follows:

1. HttpSession

2. HttpServletRequest

3. HttpServletResponse

4. HttpSessionBindingListener

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Classes in javax.servlet.http package

There are many classes in javax.servlet.http package. They are

as follows:

1. Cookie

2. HttpServlet

3. HttpSessionEvent

4. HttpSessionBindingEvent

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Interfaces - javax.servlet.http package

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Interface - javax.servlet.http.HttpSession

public interface HttpSession

 The HttpSession interface is implemented by services to provide an

association between an HTTP client and HTTP server.

 This association, or session, persists over multiple connections

and/or requests during a given time period.

 Sessions are used to maintain state and user identity across

multiple page requests.


PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Method Description

getId() Returns the identifier assigned to this session.

 getCreationTime() Returns the time at which this session representation

was created, in milliseconds since midnight, January

1, 1970 UTC.

getLastAccessedTime() Returns the last time the client sent a request carrying

the identifier assigned to the session.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Interface - javax.servlet.http.HttpServletRequest

public interface HttpServletRequest

 This interface gets data from the client to the servlet for use in

the HttpServlet.service method.

 It allows the HTTP-protocol specified header information to be accessed from

the service method.

 This interface is implemented by network-service developers for use within servlets.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Method Description
getMethod() Gets the HTTP method (for example, GET, POST, PUT) with which this
request was made.

 getPathInfo() Gets any optional extra path information following the servlet path of this
request's URI, but immediately preceding its query string

getSession() Gets the current valid session associated with this request, if create is false
or, if necessary, creates a new session for the request.

getHeader(String) Gets the value of the requested header field of this request.

 getCookies() Gets the array of cookies found in this request.

getAuthType() Gets the authentication scheme of this request.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Interface - javax.servlet.http.HttpServletResponse

public interface HttpServletResponse

 This interface allows a servlet's service method to manipulate HTTP-protocol

specified header information and return data to its client.

 It is implemented by network service developers for use within servlets.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Method Description

 addCookies(cookies cookie) adds cookies in this response.

Boolean Returns true if the response header contains the field f

containsHeader(String f)

encodeURL(string url) To encode the specified URL

sendError(int code) Sends error code to the client

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Interface - javax.servlet.http. HttpSessionBindingListener

public interface HttpSessionBindingListener

 Objects implement this interface so that they can be notified when they are being

bound or unbound from a HttpSession.

 When a binding occurs (using HttpSession.putValue) HttpSessionBindingEvent

communicates the event and identifies the session into which the object is bound.

 Similarly, when an unbinding occurs (using HttpSession.removeValue)

HttpSessionBindingEvent communicates the event and identifies the session from

which the object is unbound.


PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Method Description

Get Value() Returns the value of bounded or unbounded

getName() Returns the name being bound or unbound

HttpSession getsession() Returns the session to which the listener can be

bound or unbound

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Classes - javax.servlet.http package

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Class - javax.servlet.http.Cookie

public class Cookie

 This class represents a "Cookie", as used for session management with HTTP

and HTTPS protocols.

 Cookies are used to get user agents (web browsers etc) to hold small amounts of

state associated with a user's web browsing.

 Common applications for cookies include storing user preferences, automating

low security user signon facilities, and helping collect data used for "shopping

cart" style applications.


PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Method Description

getValue() Returns the value of the cookie.

 setValue(String) Sets the value of the cookie

getName() Returns the name of the cookie.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Class - javax.servlet.http.HttpServlet

public abstract class HttpServlet extends GenericServlet

 An abstract class that simplifies writing HTTP servlets.

 It extends the GenericServlet base class and provides an framework

for handling the HTTP protocol.

 Because it is an abstract class, servlet writers must subclass it and

override at least one method.


PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Method Description

doGet(HttpServletRequest, Performs the HTTP GET operation; the default implementation reports

an HTTP BAD_REQUEST error.


HttpServletResponse)

doPost(HttpServletRequest, Performs the HTTP POST operation; the default implementation reports

an HTTP BAD_REQUEST error.


HttpServletResponse)

doPut(HttpServletRequest, Performs the HTTP PUT operation; the default implementation reports

an HTTP BAD_REQUEST error


HttpServletResponse)

service(HttpServletRequest, This is an HTTP-specific version of the Servlet.service method, which

accepts HTTP specific parameters


HttpServletResponse)

.
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Interface - javax.servlet.http.HttpSessionEvent

public interface HttpSessionevent

 The HttpSession interface is implemented by services to provide an

association between an HTTP client and HTTP server.

 This association, or session, persists over multiple connections

and/or requests during a given time period.

 Sessions are used to maintain state and user identity across

multiple page requests.


PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Method Description

getId() Returns the identifier assigned to this session.

 getCreationTime() Returns the time at which this session representation

was created, in milliseconds since midnight, January

1, 1970 UTC.

getLastAccessedTime() Returns the last time the client sent a request carrying

the identifier assigned to the session.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Class - javax.servlet.http.HttpSessionBindingEvent

public interface HttpSessionBindingListener

 Objects implement this interface so that they can be notified when they are being

bound or unbound from a HttpSession.

 When a binding occurs (using HttpSession.putValue) HttpSessionBindingEvent

communicates the event and identifies the session into which the object is bound.

 Similarly, when an unbinding occurs (using HttpSession.removeValue)

HttpSessionBindingEvent communicates the event and identifies the session from

which the object is unbound.


PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Method Description

Get Value() Returns the value of bounded or unbounded

getName() Returns the name being bound or unbound

HttpSession getsession() Returns the session to which the listener can be

bound or unbound

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Servlet Class Hierarchy

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
The following figure shows the high level design of the hierarchy of interfaces
and classes in javax.servlet and javax.servlet.http packages:

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
 The Servlet Class Hierarchy consists of two top level interfaces which are
implemented by the GenericServlet class:
 javax.servlet.Servlet
 javax.servlet.ServletConfig
 The GenericServlet class is extended by the HttpServlet class which in turn
is extended by a user defined class.
 The Servlet Life Cycle includes:
 Initialization of servlet instance using the init() method.
 Servicing a client request using the service() method.
 Destroying a servlet instance using the destroy() method.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Class Hierarchy

1. interface javax.servlet.http.HttpServletRequest
2. interface javax.servlet.http.HttpServletResponse
3. interface javax.servlet.http.HttpSession
4. interface javax.servlet.http.HttpSessionBindingListener
5. interface javax.servlet.http.HttpSessionContext
6. interface javax.servlet.RequestDispatcher
7. interface javax.servlet.Servlet
8. interface javax.servlet.ServletConfig
9. interface javax.servlet.ServletContext
10. interface javax.servlet.ServletRequest
11. interface javax.servlet.ServletResponse
12. interface javax.servlet.SingleThreadModel

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
HTTPServlet - Service Method

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
UNIT - 3

SERVLETS
Handling
HTTP Request and Response

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
HttpServletRequest Interface
 HttpServletRequest interface
 Object passed to doGet and doPost
 Extends ServletRequest

 Methods
 String getParameter( String name )
 Returns value of parameter name (part of GET or POST)

 Enumeration getParameterNames()
 Returns names of parameters (POST)

 String[] getParameterValues( String name )


 Returns array of strings containing values of a parameter

 Cookie[] getCookies()
 Returns array of Cookie objects, can be used to identify client
HttpServletResponse Interface
 HttpServletResponse

 Object passed to doGet and doPost


 Extends ServletResponse
 Methods

 void addCookie( Cookie cookie )


 Add Cookie to header of response to client

 ServletOutputStream getOutputStream()
 Gets byte-based output stream, send binary data to client

 PrintWriter getWriter()
 Gets character-based output stream, send text to client

 void setContentType( String type )


 Specify MIME type of the response (Multipurpose Internet Mail Extensions)
 MIME type “text/html” indicates that response is HTML document.
 Helps display data
Servlets Form Data

https://www.youtube.com/watch?v=wHWG3cYQj3k

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Request and Response – GET v/s POST
 The HTTP request method determines whether doGet() or doPost() runs.
GET (doGet()) POST (doPost())

The request contains only the request line Along with request line and header
HTTP Request and HTTP header. it also contains HTTP body.

Parameter passing The form elements are passed to the server by The form elements are passed in the
appending at the end of the URL. body of the HTTP request.

Size The parameter data is limited (the limit Can send huge amount of data to
depends on the container) the server.

Idempotency GET is Idempotent POST is not idempotent

Usage Generally used to fetch some information Generally used to process the sent
from the host. data.

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Handling
HTTP – GET Request
https://www.youtube.com/watch?v=m6rge4XteiI

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Handling HTTP GET Requests
 HTTP GET requests
 Usually gets content of specified URL
 Usually HTML document (web page)

 Example servlet
 Handles HTTP GET requests

 User clicks Get Page button in HTML document


 GET request sent to servlet HTTPGetServlet

 Servlet dynamically creates HTML document displaying "Welcome to


Servlets!"
1 //Eg: HTTPGetServlet.java
2 // Creating and sending a page to the client
3 import javax.servlet.*;
4 import javax.servlet.http.*; Import necessary classes and
5 import java.io.*;
inherit methods from
6
7 public class HTTPGetServlet extends
HttpServlet.
HttpServlet { 1. import
8 public void doGet( HttpServletRequest request,
9 HttpServletResponse response ) 1.1 extends HttpServlet
10 throws ServletException, IOException
11 { 2. doGet
12 PrintWriter output;
2.1 setContentType
13
14 response.setContentType( "text/html" ); // content type
2.2 getWriter
15 output = response.getWriter(); // get writer
16 2.3 println
17 // create and send HTML page to client
Create PrintWriter object.
18 StringBuffer buf = new StringBuffer();
19 buf.append( "<HTML><HEAD><TITLE>\n" );
Create HTML file and send
20 buf.append( "A Simple Servlet Example\n" ); to client.
21 buf.append( "</TITLE></HEAD><BODY>\n" );
22 buf.append( "<H1>Welcome to Servlets!</H1>\n" );
23 buf.append( "</BODY></HTML>" );
24 output.println( buf.toString() );
25 output.close(); // close PrintWriter stream
26 }
27 }
Eg. HTTPGetServlet.html
1 <!-- HTTPGetServlet.html -->
2 <HTML>
3 <HEAD>
4 <TITLE>
5 Servlet HTTP GET Example
ACTION specifies form
6 </TITLE>
handler, METHOD specifies
7 </HEAD>
8 <BODY>
request type.
9 <FORM
10 ACTION="http://lab.cs.siu.edu:8080/rahimi/HTTPGetServlet"
HTML document
11 METHOD="GET">
12 <P>Click the button to have the servlet send
13 an HTML document</P> 1. <TITLE>
14 <INPUT TYPE="submit" VALUE="Get HTML Document">
15 </FORM> 2. <FORM>
16 </BODY>
17 </HTML> Creates submit button,
2.1 ACTION
performs ACTION
when clicked.
2.2 METHOD

3. INPUT TYPE
Program Output
Example Explained
3 import javax.servlet.*;
4 import javax.servlet.http.*;

 Use data types from javax.servlet and javax.servlet.http

7 public class HTTPGetServlet extends HttpServlet {


 HttpServlet has useful methods, inherit from it

8 public void doGet( HttpServletRequest request,


9 HttpServletResponse response )
10 throws ServletException, IOException
 Method doGet
 Responds to GET requests
 Default action: BAD_REQUEST error (file not found)
 Override for custom GET processing
 Arguments represent client request and server response
14 response.setContentType( "text/html" ); // content type

 setContentType
 Specify content
 text/html for HTML documents

12
15 PrintWriter output;
output = response.getWriter(); // get writer

 getWriter
 Returns PrintWriter object, can send text to client
 getOutputStream to send binary data (returns
ServletOutputStream object)
19 buf.append( "<HTML><HEAD><TITLE>\n" );
20 buf.append( "A Simple Servlet Example\n" );
21 buf.append( "</TITLE></HEAD><BODY>\n" );
22 buf.append( "<H1>Welcome to Servlets!</H1>\n" );
23 buf.append( "</BODY></HTML>" );

 Lines 19-23 create HTML document

24 output.println( buf.toString() );
25 output.close(); // close PrintWriter stream

 println sends response to client


 close terminates output stream
 Flushes buffer, sends info to client
For program Check

program name : ServletFormDataGETApp

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Handling
HTTP – POST Request
https://www.youtube.com/watch?v=rPFrNU2Qftw

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Handling HTTP POST Requests
 HTTP POST
 Used to post data to server-side form handler (i.e. surveys)
 Both GET and POST can supply parameters

 Example servlet
 Survey
 Store results in file on server

 User selects radio button, presses Submit


 Browser sends POST request to servlet

 Servlet updates responses


 Displays cumulative results
1 // HTTPPostServlet.java
2 // A simple survey servlet
3 import javax.servlet.*;
4 import javax.servlet.http.*; Extending HttpServlet
5 import java.text.*; allows processing of GET
6 import java.io.*;
7 import java.util.*;
and POST requests.
8
9 public class HTTPPostServlet extends HttpServlet {
10 private String animalNames[] = 1. import
11 { "dog", "cat", "bird", "snake", "none" };
12 1.1 extends HttpServlet
13 public void doPost( HttpServletRequest request,
14 HttpServletResponse response )
15 throws ServletException, IOException
1.2 animalNames
16 {
17 int animals[] = null, total = 0; 2. doPost
18 File f = new File( "survey.txt" );
19 2.1 Open file
20 if ( f.exists() ) {
21 // Determine # of survey responses so far
22 try {
2.2 getParameter
23 ObjectInputStream input = new ObjectInputStream(
24 new FileInputStream( f ) ); 2.3 Write to file
25
26 animals = (int []) input.readObject(); 2.4 getWriter
27 input.close(); // close stream
28
29 for ( int i = 0; i < animals.length; ++i ) 2.5 Create HTML code
30 total += animals[ i ];
31 } 2.6 println
32 catch( ClassNotFoundException cnfe ) {
33 cnfe.printStackTrace();
34 }
35 }
Use request (HttpServletRequest)
36 else method getParameter to get value of
37 animals = new int[ 5 ]; animal.
38
39 // read current survey response
40 String value =
41 request.getParameter( "animal" ); 1. import
42 ++total; // update total of all responses
43 1.1 extends HttpServlet
44 // determine which was selected and update its total
45 for ( int i = 0; i < animalNames.length; ++i )
46 if ( value.equals( animalNames[ i ] ) )
1.2 animalNames
47 ++animals[ i ];
48 2. doPost
49 // write updated totals out to disk
50 ObjectOutputStream output = new ObjectOutputStream( 2.1 Open file
51 2.2 getParameter
new FileOutputStream( f ) );
52
53 output.writeObject( animals ); 2.2 getParameter
54 output.flush();
55 output.close(); 2.3 Write to file
56
57
2.3 Write to file
// Calculate percentages
58 double percentages[] = new double[ animals.length ];
2.4 getWriter
59
60 for ( int i = 0; i < percentages.length; ++i ) 2.5 Create HTML code
61 percentages[ i ] = 100.0 * animals[ i ] / total;
62 2.6 println
63 // send a thank you message to client
64 response.setContentType( "text/html" ); // content type
65
66 PrintWriter responseOutput = response.getWriter();
67 StringBuffer buf = new StringBuffer();
68 buf.append( "<html>\n" );
69 buf.append( "<title>Thank you!</title>\n" );
70 buf.append( "Thank you for participating.\n" );
71 buf.append( "<BR>Results:\n<PRE>" ); 1. import
72
73 DecimalFormat twoDigits = new DecimalFormat( "#0.00" );
1.1 extends HttpServlet
74 for ( int i = 0; i < percentages.length; ++i ) {
75 buf.append( "<BR>" );
76 buf.append( animalNames[ i ] );
1.2 animalNames
77 buf.append( ": " );
78 buf.append( twoDigits.format( percentages[ i ] ) ); 2. doPost
79 buf.append( "% responses: " );
2.1 Open file
80
81 2.4 getWriter
buf.append( animals[ i ] );
buf.append( "\n" );
82 } 2.2 getParameter
83
84 buf.append( "\n<BR><BR>Total responses: " );
2.3 Write to file
85
86
2.5 Create HTML code
buf.append( total );
buf.append( "</PRE>\n</html>" );
87 2.4 getWriter
88 responseOutput.println( buf.toString() );
89 responseOutput.close(); 2.5 Create HTML code
90 } 2.6 println
91 } 2.6 println
1 <!-- HTTPPostServlet.html -->
2 <HTML>
3 <HEAD>
4 <TITLE>Servlet HTTP Post Example</TITLE>
5 </HEAD>
Use a POST request
6
7 <BODY>
type. 1. <FORM>
8 <FORM METHOD="POST" ACTION=
9 "http://lab.cs.siu.edu:8080/rahimi/HTTPPostServlet"> 1.1 METHOD="POST"
10 What is your favorite pet?<BR><BR>
11 <INPUT TYPE=radio NAME=animal VALUE=dog>Dog<BR> 2. <INPUT>
12 <INPUT TYPE=radio NAME=animal VALUE=cat>Cat<BR>
13 <INPUT TYPE=radio NAME=animal VALUE=bird>Bird<BR>
14 <INPUT TYPE=radio NAME=animal VALUE=snake>Snake<BR>
15 <INPUT TYPE=radio NAME=animal VALUE=none CHECKED>None
16 <BR><BR><INPUT TYPE=submit VALUE="Submit">
17 <INPUT TYPE=reset>
18 </FORM>
19 </BODY>
Create radio buttons. Specify
20 </HTML>
parameter name and value. None is
initially selected (CHECKED).
Returns form to original
state (None selected).
Program Output
For program Check

program name : ServletFormDataPOSTApp

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
UNIT - 3

SERVLETS
SESSION TRACKING

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
SESSION TRACKING API
https://www.youtube.com/watch?
v=jOGg2cLcEic&list=UUhwKlOVR041tngjerWxVccw&index=2

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
What is Session Tracking?

https://www.youtube.com/watch?
v=VLg7WV5L0S4&list=UUhwKlOVR041tngjerWxVccw&index=1

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
For Program Check :

Program Name :

1. HttpSessionAttributeDemoApp
2. HttpSession
3. HttpSession Login and Logout Example

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
User Authorization

https://www.youtube.com/watch?v=XyJe3jXEeqo
User Authorization
 The web server requests the user name and password. The

information is available to any servlet that needs it.

 The browser resends the name and password with each

subsequent request.

 Data about the user and the user’s state can be saved in a shared

object.
Cookies
https://www.youtube.com/watch?v=lxxYdV92LLM

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Cookies Class

https://www.youtube.com/watch?v=Eu3YXeXC9e8

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Cookie Create/Delete/Get

https://www.youtube.com/watch?v=Wi-zmexenB0

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Cookies Demo

https://www.youtube.com/watch?
v=lbwFTNyRv8I&list=UUhwKlOVR041tngjerWxVccw&index=3

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
For Program Check :

Program Name :

1.CookieDemoApp
2.Cookies Login and Logout Example

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
 URL Rewriting
https://www.youtube.com/watch?v=HnjvCnrHkmk

https://www.youtube.com/watch?v=0Ch2Bfea5yw

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
For Program Check :

Program Name : URLRewritingDemoApp

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Hidden Form Field
https://www.youtube.com/watch?v=nbLc7e7EJiI

https://www.youtube.com/watch?
v=64hZwZ8hDs0&list=UUhwKlOVR041tngjerWxVccw&index=4

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
For Program Check :

Program Name : HiddenFormFieldDemoApp

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
UNIT - 3

SERVLETS
JDBC

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
JDBC Introduction
http://ramj2ee.blogspot.in/2014/07/jdbc-introduction.html#.Vq5eJpp97Mw

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
JDBC Architecture

http://ramj2ee.blogspot.in/2014/07/jdbc-architecture.html#.Vq5eeJp97Mw

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Steps to Connect to the Database

https://www.youtube.com/watch?v=JCtOzn1r2MY

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
How the JDBC Application works

https://www.youtube.com/watch?v=ry8AUOCccdY

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
JDBC Demo

For Programs Check


Program Name : JDBCDemoApp

Environment Used :
JDK version : 1.7.0_51
Mysql Server version : 5.6.19

https://www.youtube.com/watch?v=uRrctWrry4I

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Driver Manager
https://www.youtube.com/watch?v=PeV1mC2z--M

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Extra :

Java Decompiler

Check the Software for Seeing Java Decompiler

Download Link: http://jd.benow.ca/

https://www.youtube.com/watch?v=z-dYli574dE

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Extra :

JDBC Driver Details


https://www.youtube.com/watch?v=KbAo5Ii-QLk

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
For Programs Check
Program Name :
JDBCDriverDetailsDemoApp

Environment Used :
JDK version : 1.7.0_51
Mysql Server version : 5.6.19

https://www.youtube.com/watch?v=KbAo5Ii-QLk
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Extra :

Load JDBC Driver


Check the Software for Seeing mysql-connector-java-5.1.38.zip

Download Link https://dev.mysql.com/downloads/file/?id=460363

https://www.youtube.com/watch?v=fA539fwWtHY

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
For Programs Check
Program Name :
LoadJDBCDriverDemoApp
Environment Used :
JDK version : 1.7.0_51
Mysql Server version : 5.6.19

https://www.youtube.com/watch?v=fA539fwWtHY
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Extra :

JDBC Connection
https://www.youtube.com/watch?v=qDD6YaK0W_U

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Extra :

JDBC : Connection URL


https://www.youtube.com/watch?v=k1SW1GS9_zA

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Extra :

JDBC Connection Demo

https://www.youtube.com/watch?v=O4SNaqaWjA0

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
For Programs Check
Program Name :
JDBCConnectionDemoApp
Environment Used :
JDK version :1.7.0_51
Tomcat version : 7.0.50 

https://www.youtube.com/watch?v=fA539fwWtHY
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Extra :

JDBC Demo –
Connect to Oracle Database

https://www.youtube.com/watch?v=D-c3EyuHUlA

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
For Programs Check
Program Name :
JDBCOracleDemoApp
Environment Used :
JDK version : 1.7.0_51
Oracle 11g 

https://www.youtube.com/watch?v=D-c3EyuHUlA
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
JDBC Driver Types
https://www.youtube.com/watch?v=-MLj-NIkEWo

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
JDBC Driver

1. Type 1 JDBC Driver : JDBC-ODBC Bridge Driver (Bridge Driver)

2. Type 2 JDBC Driver: Native-API driver/Partly Java driver (Native

Driver)

3. Type 3 Driver : AllJava/Net-protocol driver or Network Protocol Driver

(Middleware Driver)

4. Type 4 Driver : All Java/Native-protocol driver or Thin Driver (Pure Java

Driver)
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H
Type 1 JDBC Driver :
JDBC-ODBC Bridge Driver
(Bridge Driver)

https://www.youtube.com/watch?v=np3TQe9mE0o

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Type 2 JDBC Driver :
Native-API driver/Partly Java driver
(Native Driver)

https://www.youtube.com/watch?v=9L7BRUTxbu8

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Type 3 Driver :
AllJava/Net-protocol driver or
Network Protocol Driver
(Middleware Driver)
https://www.youtube.com/watch?v=yd4nFHkCe2Q

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
Type 4 Driver :
All Java/Native-protocol driver or
Thin Driver
(Pure Java Driver)
https://www.youtube.com/watch?v=qlu5cx15fmk

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
JDBC : Which Driver Should be used

https://www.youtube.com/watch?v=QV75ARl8ays

PRASAD B, Assoc. prof.,


MLRITM,JNTU-H
PRASAD B, Assoc. prof.,
MLRITM,JNTU-H

You might also like