Print This Article Post Comment Add To Favorites Email to Friends Ezine Ready

Servlet Packages And Task In Java

By: Infocampus Home | Computers-and-Technology


Introduction :

Servlet provides a component-based, platform-independent method for building Web-based applications , without the performance limitations of CGI programs. Servlets have access to the entire family of Java APIs, including the JDBC API to access enterprise databases.

Java Servlets are programs that run on a Web or Application server and act as a middle layer between a request coming from a Web browser or other HTTP client and databases or applications on the HTTP server.
Using Servlets, we can collect input from users through web page forms, present records from a database or another source, and create web pages dynamically.
Java Servlets often serve Advanced java training in bangalore the same purpose as programs implemented using the Common Gateway Interface (CGI). But Servlets offer several advantages in comparison with the CGI.Performance is significantly better.
Features Of Servlet :
- Servlets execute within the address space of a Web server . It is not necessary to create a separate process to handle each client request .
- Servlets are platform-independent because they are written in Java .
- Java security manager on the server enforces a set of restrictions to protect the resources on a server machine. So servlets are trusted.
- The full functionality of the Java class libraries is available to a servlet. It can communicate with applets, databases, java/j2ee classes bangalore or other software via the sockets and RMI mechanisms that you have seen already.
Servlets Tasks:
Servlets perform the following major tasks:
- Read the explicit data sent by the clients (browsers). This includes an HTML form on a Web page or it could also come from an applet or a custom HTTP client program.
- Read the implicit HTTP request data sent by the clients (browsers). This includes cookies, media types and compression schemes the browser understands, and so forth.
- Process the data and generate the results. This process may require talking to a database, executing an RMI or CORBA call, invoking a Web service, or computing the response directly. Java training center bangalore
- Send the explicit data (i.e., the document) to the clients (browsers). This document can be sent in a variety of formats, including text (HTML or XML), binary (GIF images), Excel, etc.
- Send the implicit HTTP response to the clients (browsers). This includes telling the browsers or other clients what type of document is being returned (e.g., HTML), setting cookies and caching parameters, and other such tasks.
Servlets Packages:
Java Servlets are Java classes run by a web server that has an interpreter that supports the Java Servlet specification.
Servlets can be created using the javax.servlet and javax.servlet.http packages , which are a standard part of the Java's enterprise edition, java course in bangalore an expanded version of the Java class library that supports large-scale development projects.
Servlet Life Cycle :
A servlet life cycle can be defined as the entire process from its creation till the destruction. The following are the paths followed by a servlet
-The servlet is initialized by calling the init () method.
-The servlet calls service() method to process a client's request.
-The servlet is terminated by calling the destroy() method.
- Finally, servlet is garbage collected by the garbage collector of the JVM.
The init() method :
The init method is designed to be called only once. It is called when the servlet is first created, and not called again for each user request. Best core java training in bangalore So, it is used for one-time initializations, just as with the init method of applets.
The service() method :
The service() method is the main method to perform the actual task. The servlet container (i.e. web server) calls the service() method to handle requests coming from the client( browsers) and to write the formatted response back to the client.
Each time the server receives a request for a servlet, the server spawns a new thread and calls service. The service() method checks the HTTP request type (GET, POST, PUT, DELETE, etc.) and calls doGet, doPost, doPut, doDelete, etc. methods as appropriate.
The destroy() method :
The destroy() method is called only once at the end of the life cycle of a servlet. This method gives servlet a Advanced java training in bangalore chance to close database connections, halt background threads, write cookie lists or hit counts to disk, and perform other such cleanup activities.
This is the short description about the Servlet . To get the deep knowledge on java course join Infocampus Software Training Institute .




Article Source: http://www.eArticlesOnline.com

About the Author:
Infocampus provides best Advanced Java Training in Bangalore . It provides java training with the complete practical session . Java course is available for weekdays & weekends on flexible timing with the less fees. Payment in installament option is available for java/j2ee classes .
Learn OOPs concept , packages , threading , struts framework , JDBC in Core & Advanced java classes . Infocampus provides best core java training with the real time project . Trainers having 10+ years experience.
To book the seat for free demo class call at : 9738001024 or to know the syllabus of
Advanced java training enquire at : http://www.infocampus.co.in/java-training-bangalore.html

Tags: , , , ,

Please Rate this Article

 

Not yet Rated

Click the XML Icon Above to Receive Computers-and-Technology Articles Via RSS!

Recent Related Articles From Computers-and-Technology

  • Web Design Composition Curriculum For 2017-2018
    By: Infocampus | May 24th 2017
    On the off chance that you are showing your understudies 'old fashioned' techniques from that time (ex: XHTML, Dreamweaver, Photoshop) that is likened to showing them how to utilize . Truth be told, showing old website architecture techniques may even be more terrible than instructing understudies to utilize a , in light o ... Read

  • What Is The Importance Of Immutable Property For String Class
    By: Infocampus | May 24th 2017
    Java String is class that java developers have written and put into java API . It is present in java.lang package. So when we will try to modify, new object will be created. Read

  • Are Emailed Invoices As Good As The Digital Ones?
    By: Jason Legg | May 24th 2017
    In short this post will go through the various kinds of email invoicing. Read

  • How Business Structure Can Be Improved By Sms Termination India?
    By: renukatewani | May 23rd 2017
    SMS termination India is nothing but a trend setter in the world of business promotion. A direct communication can be established and maintained in between you and your customers by this text service. Read

  • An Overview Of Bulk Invoice Emailing
    By: Jeremy Brown | May 22nd 2017
    Among the fastest and simplest ways for businesses to save lots of profit these belt tensing times is to begin bulk invoice emailing. Read

  • Evaluating Some Important Facts Before Opting Box Build Assembly Services
    By: PrintedCircuits | May 22nd 2017
    An overall electrochemical assembly process embracing other processes such as enclosure fabrication, installation and routing of cable harnesses, and installation of sub-assemblies and components is collectively known as systems integration or a box build. It is an assembly work other than the printed circuit board (PCB) pr ... Read

  • How To Connect Database In Java?
    By: Infocampus | May 22nd 2017
    For connecting a database with the application 5 steps are needed as Register the driver class , Creating connection , Creating statement, Executing queries, Closing connection. Read

  • Prepare Your Homes For Summers With Ac Installation Or Repair In St Louis
    By: Sophia Hill | May 22nd 2017
    When it comes to AC or condenser repair in St Louis then hiring professional HVAC contractors is most important thing. Professional HVAC contractors must take care of your systems and ensure the long-lasting performance. For air condition repair or installation in St Louis, Ricotta Heating & Air is the company to call upon. Read

  • How To Use The Html5 Sectioning Elements
    By: Infocampus | May 20th 2017
    The Problem With Link
    Consistently, a huge number of Web engineers conjure the omnipotent to gap, segment and ring-fence their Web pages' substance. We utilize the to police substance, to keep unique lumps of data from caving in into each other.
    Read

  • How Hibernate Framework Works In Java
    By: Infocampus | May 20th 2017
    Hibernate framework simplifies the development of java application to interact with the database. Hibernate is an open source, lightweight, ORM (Object Relational Mapping) tool. Read


Copyright © 2005-2015 eArticlesOnline, LLC - All Rights Reserved
Terms of Service | Privacy Policy