Professional Documents
Culture Documents
SEMESTER: 6
PREPARED BY: PROF. NITI KHETRA
APPLICATIONS
J2EE
J2SE J2ME
JAVA2 ENTERPRICE
JAVA2 STANDARE DEDITION JAVA2 MICRO EDEDITION
EDEDITION
• Collection information
Web pages are a presentation of information (your content) which can be presented in carefully chosen media most appropriate for your content.
Web pages can be static or dynamic, meaning that the content is the same each time someone visits the webpage or is taken from a database which
is updated with new content.
⚫ Examples of media that can be use in your website
• What is server?
• What is client ?
• A Web browser is the software that you run on your computer to make it work as a web client.
PC/Mac/Unix
Client + Browser (IE, FireFox)
Request:
http://www.yahoo.com/default.html
Network HTTP
TCP/IP
Response:
<html>…</html>
Server
Web Server
STRUCTURE OF A UNIFORM RESOURCE LOCATORS
pathname
protocol
http://www.chicagosymphony.org/civicconcerts/index.htm
• The HTTP request messages use GET or POST methods for transmitting
requests over the web.
• Get method is used when retrieving information such as a document, a
chart, or database query results. The information to the retrieved is passed
as a sequence of characters called query string. Hance. The data being
passed in visible to the client. Appending query string in a Uniform
Resource Locator(URL) enable page to bookmarked or emailed. However, the
length of query string is restricted to 240 to 255 characters depending on
the server.
• POST method is used when sending information such as credit card
numbers or information to be saved in the database data sent using post is
not visible to the client and there is no limit on the amount of data being
sent. Pages requested using POST method cannot be bookmarked or
emailed.
Business Logic
• Introduction to Servlets
• A server is device with provides information requested by different devices(clients) on a network. For example, a file
server gives information about different files on the network. Initially, the transfer of data over the web was carried
out by writing Common Gateway Interface(CGI) programs written in a language such as Perl. However for each
request made by the client, a new instance of CGI program had to be created, which would occupy a large amount
of memory. To overcome this servlets were introduced.
• A servlet is program written in java Which runs on a server, processes the requested information and send it to the
client. The clients of the Servlet can be any java application, a browser or any device, which can make a request
and get response for the request.
• This instance of servlet is created only once for all client requests thus saving a hung amount of memory, A servlet
once initialized, stays in the memory, so need not to loaded every time a request made.
It is thread based i.e. for every new request new thread is It is process based i.e. for every new request new
Approach
created. process is created.
Server Indepent It can use any of the web-server. It can use the web-server that supports it.
Link It links directly to the server. It does not links directly to the server.
HTTP server It can read and set HTTP servers. It can neither read nor set HTTP servers.
instantiation
• The Servlet interface defines 3 methods of servlet life cycle
• 1)init()
• 2)service() initialization
• 3)destroy()
Service
Destroy
classes
ServletOutputStream ServletInputStream
Interface
ServletConfig ServletResponse
ServletContext ServletRequest
DEPARTMENT OF COMPUTER ENGINEERING, *Proprietary material of SILVER OAK
UNIVERSITY
DEPARTMENT OF COMPUTER ENGINEERING, *Proprietary material of SILVER OAK
UNIVERSITY
DEPARTMENT OF COMPUTER ENGINEERING, *Proprietary material of SILVER OAK
UNIVERSITY
INTRODUCTION TO SESSION
TRACKING
SESSION TRACKING
• Session is the period during which the client opens a connection with
the server, makes requests and the server responds to client’s
requests. Session tracking allows the server to keep a track of
successive requests made by the same client. When a client requests
for a page, the server responds with the required page. If the same
client requests for another page, The server treats it as a new client.
• For example
• A customer wants to do shopping online, The customer may select items
form the list and put it in the cart. When the same customer clicks on a new
page, the previously selected items are lost. As a result, it is necessary to
keep a track of successive requests made by the same user. Session
Tracking allows the customer to maintain a connation with the server as
long the customer does not log out from the website.