Academic Tutorials



English | French | Portugese | German | Italian
Home Advertise Payments Recommended Websites Interview Questions FAQs
News Source Codes E-Books Downloads Jobs Web Hosting
Chats

Servlets Tutorial
Servlets Introduction
Servlets Life Cycle
Handling the Client Request:Form Data
Handling the Client Request: HTTP Request Headers
Accessing the Standard CGI Variables
Generating the Server Response: HTTP Status Codes
Generating the Server Response: HTTP Response Headers
Handling Cookies
Session Tracking
Connecting to database in Servlets
Filters in Servlet
Servlets Summary

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
HLML
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
PHP
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
OOPs
Data Warehousing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting
Network Sites


Introduction to Servlets

Previoushome Next




  • Servlets are Java programs running on a web server that produce results viewed remotely on web server.



  • A D V E R T I S E M E N T
  • Servlets has the same purpose that PHP or CGI had in the past.



  • We shall describe how Servlet works with some examples.



  • You will also learn about Servlet Response and Request Model, Servlet Life Cycle, Servlet Scope Objects and Error Handling.




What are Java Servlets?

Servlets are Java technology's answer to the CGI programming. They are programs that run on a Web server and build Web page. Building Web pages on the fly is useful (and commonly done) for a number of reason:

  • The Web page is based on the data submitted by the user. For example the result pages from search engines are generated this way, and programs that process orders for e-commerce sites do this as well.

  • The data alsp changes frequently. For example, a weather-report or news headlines page might build the page dynamically, perhaps returning a previously built page if it is still up to the date.

  • The Web page uses information from corporate databases or other such source. For example, you would use this for making a Web page at an on-line store that lists current prices and number of items in the stock.




What are the Advantage of Servlets Over "Traditional" CGI?

Java servlets are more efficient, easier to use, more powerful, more portable, and cheaper than traditional CGI and than many alternative CGI-like technology. (More importantly, servlet developers get paid more than Perl programmers :-).

  • Efficient. With traditional CGI, a new process is started for the each HTTP request. If the CGI program does a relatively fast operation, the overhead of starting the process can dominate the execution of time. With servlets, the Java Virtual Machine stays up, and each request is handled by a lightweight Java thread, not the heavyweight operating system process. Similarly, in traditional CGI, if there are N simultaneous request to the same CGI program, then the for the CGI program is loaded into memory N time. With servlets, however, there are N threads but only a single copy of the servlets class. Servlets also have more alternatives than do regular CGI programs for optimizations such as caching previous computations, keeping the database connections open, and the like.



  • Convenient. Hey, you already know Java. Why learn Perl too? Besides the convenience of being able to use a familiar language, servlets have an extensive infrastructure for automatically parsing and decoding the HTML form data, reading and setting HTTP headers, handling cookies, tracking sessions, and many other such utilities.

  • Powerful. Java servlets let you easily do several things that are difficult or impossible with the regular CGI. For one thing, servlets can talk directly to Web server (regular CGI programs can't). This simplifies operations that need to look up images and other data stored in the standard places. Servlets can also share data among each other, making the useful things like database connection pools easy to implement. They can also maintain information from request to request, simplifying things like session tracking and caching of previous computation.

  • Portable. Servlets are written in Java and followsss a well-standardized API. Consequently, servlets written for, say I-Planet Enterprise Server can alsp run virtually unchanged on Apache, Microsoft IIS, or WebStar. Servlets are supported directly or via a plugin on the almost every major Web server.

  • Inexpensive. There are also a number of free or very inexpensive Web servers available that are good for "personal" use or low-volume Web sites. However, with major exception of Apache, which is free, most commercial-quality Web servers are relatively expensive. Nevertheless, once you have a Web server, no matter the cost of that server, adding servlets support to it (if it doesn't come preconfigured to support servlets) is generally free or cheap.




Advantages of servlets over CGI processes

Servlets:

  • have significantly less overhead than CGI
  • can inherit processing state between invocation
  • can use concurrency control in the Java to share state at server.


  • Servlets compared to CGI programs:
  • are slower only when being initially it is loaded
  • rather faster to run when it is loaded.


  • Servlets can:
  • open a database connection when initially it is loaded
  • share open DB connection with successive invocation
  • CGI programs have to renew the DB connection each time they're run.


  • Servlets can:
  • store state information in the static variables in servlet
  • share access to the state data each time servlet is run
  • control concurrent access to the shared state easily
  • CGI programs lack the common address space to share state easily.



  • Disadvantages of servlets over CGI processes

  • cruder model of concurrency
  • less robust - share common address space in the JVM process
  • more complex to handle, write and configure



  • What You Should Already Know

    Before you goes to this tutorial you should have a basic understanding of the following:

    • HTML
    • A basic understanding of JAVA

    If you are going to study these subjects first, find the tutorial on our Home page



    Be the first one to comment on this page.




      Servlets Tutorial eBooks

    No eBooks on Servlets could be found as of now.

     
     Servlets Tutorial FAQs
    More Links » »
     
     Servlets Tutorial Interview Questions
    More Links » »
     
     Servlets Tutorial Articles
    More Links » »
     
     Servlets Tutorial News
    More Links » »
     
     Servlets Tutorial Jobs
    More Links » »

    Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
    • blinkbits
    • BlinkList
    • blogmarks
    • co.mments
    • connotea
    • del.icio.us
    • De.lirio.us
    • digg
    • Fark
    • feedmelinks
    • Furl
    • LinkaGoGo
    • Ma.gnolia
    • NewsVine
    • Netvouz
    • RawSugar
    • Reddit
    • scuttle
    • Shadows
    • Simpy
    • Smarking
    • Spurl
    • TailRank
    • Wists
    • YahooMyWeb

    Previoushome Next

    Keywords: java servlets, core servlets and jsp, servlet api, servlet engine

    HTML Quizzes
    HTML Quiz
    XHTML Quiz
    CSS Quiz
    TCP/IP Quiz
    CSS 1.0 Quiz
    CSS 2.0 Quiz
    HLML Quiz
    XML Quizzes
    XML Quiz
    XSL Quiz
    XSLT Quiz
    DTD Quiz
    Schema Quiz
    XForms Quiz
    XSL-FO Quiz
    XML DOM Quiz
    XLink Quiz
    XQuery Quiz
    XPath Quiz
    XPointer Quiz
    RDF Quiz
    SOAP Quiz
    WSDL Quiz
    RSS Quiz
    WAP Quiz
    Web Services Quiz
    Browser Scripting Quizzes
    JavaScript Quiz
    VBScript Quiz
    DHTML Quiz
    HTML DOM Quiz
    WMLScript Quiz
    E4X Quiz
    Server Scripting Quizzes
    ASP Quiz
    PERL Quiz
    SQL Quiz
    ADO Quiz
    CVS Quiz
    Python Quiz
    Apple Script Quiz
    PL/SQL Quiz
    SQL Server Quiz
    PHP Quiz
    .NET (dotnet) Quizzes
    Microsoft.Net Quiz
    ASP.Net Quiz
    .Net Mobile Quiz
    C# : C Sharp Quiz
    ADO.NET Quiz
    VB.NET Quiz
    VC++ Quiz
    Multimedia Quizzes
    SVG Quiz
    Flash Quiz
    Media Quiz
    SMIL Quiz
    Photoshop Quiz
    Gimp Quiz
    Matlab Quiz
    Gnuplot Programming Quiz
    GIF Animation Quiz
    Scientific Visualization Quiz
    Graphics Quiz
    Web Building Quizzes
    Web Browsers Quiz
    Web Hosting Quiz
    W3C Quiz
    Web Building Quiz
    Web Quality Quiz
    Web Semantic Quiz
    Web Careers Quiz
    Weblogic Quiz
    SEO Quiz
    Web Site Hosting Quiz
    Domain Name Quiz
    Java Quizzes
    Java Quiz
    JSP Quiz
    Servlets Quiz
    Struts Quiz
    EJB Quiz
    JMS Quiz
    JMX Quiz
    Eclipse Quiz
    J2ME Quiz
    JBOSS Quiz
    Programming Langauges Quizzes
    C Quiz
    C++ Quiz
    Visual Basic Quiz
    Data Structures Using C Quiz
    Cobol Quiz
    Assembly Language Quiz
    Mainframe Quiz
    Forth Programming Quiz
    Lisp Programming Quiz
    Pascal Quiz
    Delphi Quiz
    Fortran Quiz
    OOPs Quiz
    Data Warehousing Quiz
    CGI Programming Quiz
    Emacs Quiz
    Gnome Quiz
    ILU Quiz
    Soft Skills Quizzes
    Communication Skills Quiz
    Time Management Quiz
    Project Management Quiz
    Team Work Quiz
    Leadership Skills Quiz
    Corporate Communication Quiz
    Negotiation Skills Quiz
    Database Quizzes
    Oracle Quiz
    MySQL Quiz
    Operating System Quizzes
    BSD Quiz
    Symbian Quiz
    Unix Quiz
    Internet Quiz
    IP-Masquerading Quiz
    IPC Quiz
    MIDI Quiz
    Software Testing Quizzes
    Testing Quiz
    Firewalls Quiz
    SAP Module Quizzes
    ERP Quiz
    ABAP Quiz
    Business Warehousing Quiz
    SAP Basis Quiz
    Material Management Quiz
    Sales & Distribution Quiz
    Human Resource Quiz
    Netweaver Quiz
    Customer Relationship Management Quiz
    Production and Planning Quiz
    Networking Programming Quizzes
    Corba Quiz
    Networking Quiz
    Microsoft Office Quizzes
    Microsoft Word Quiz
    Microsoft Outlook Quiz
    Microsoft PowerPoint Quiz
    Microsoft Publisher Quiz
    Microsoft Excel Quiz
    Microsoft Front Page Quiz
    Microsoft InfoPath Quiz
    Microsoft Access Quiz
    Accounting Quizzes
    Financial Accounting Quiz
    Managerial Accounting Quiz
    Testimonials | Contact Us | Link to Us | Site Map
    Copyright ? 2008. Academic Tutorials.com. All rights reserved Privacy Policies | About Us
    Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | Discussions World | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Indian Free Ads | Jobs Assist | New Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Webhosting in India | Dedicated Server in India | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Testing Interview Questions | Tests World | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World | Important Websites
    Copyright ? 2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved.