Home | Login | Blog | Forum | Download | RSS Feed | Ajax | Hello-World | J2EE | BPM | EJB | FileNet | Hibernate | ORM | IBM | ILOG | Interview | FAQs |

Java | Apache | JVM | Others | BRMS | Oracle | Pega | SOA | Sun-Certification | Web-Service | websphere | XML |
 

JAVA DEVELOPER SITE - COMPLETE JAVA TUTORIALS

Beginners Servlets & Java Server Pages Tutorial


Share
 
 

Useful Java Links


       


Introduction to Servlets

 

Servlets are Java technology’s answer to Common Gateway Interface (CGI).They are programs that run on a Web server, acting as a middle layer between a request coming from a Web browser or other HTTP client and databases or applications on the HTTP server. Servlets are used to do:

 

Ø  Read any data sent by the user.

            This data is usually entered in a form on a Web page, but could also come from a Java          applet or a custom HTTP client program.

Ø  To See any other information about the request that is embedded in the HTTP request.

            This information includes details about browser capabilities, cookies, the host name of          the requesting client, and so forth.

Ø  Generate the results.

            This process may require talking to a database, executing an RMI or CORBA call,      invoking a legacy application, or computing the response directly.

Ø  Format the results inside a document.

      In most cases, this involves embedding the information inside an HTML page.

Ø  Set the appropriate HTTP response parameters.

      This means telling the browser what type of document is being returned (e.g., HTML),         setting cookies and caching parameters, and other such tasks.

Ø  Send the document back to the client.

            This document may be sent in text format (HTML), binary format (GIF images), or even        in a compressed format like gzip that is layered on top of some other underlying format.

 

servlets are not restricted to Web or application servers that handle HTTP requests, but can be used for other types of servers as well. For example, servlets could be embedded in mail or FTP servers to extend their functionality.

 

The Advantages of Servlets

Java servlets are more efficient, easier to use, more powerful, more portable, safer, and cheaper than traditional CGI and many alternative CGI-like technologies. Following are the advantages

 

Efficient

With CGI, a new process is started for each HTTP request. So the overhead of starting the  process can dominate the execution time. In  servlets, the Java Virtual Machine stays

running and handles each request using a lightweight Java thread, not a heavyweight operating system process. if there are N simultaneous requests to the same CGI program, the code for the CGI program is loaded into memory N times. With servlets, however, there would be N threads but only a single copy of the servlet class.

 

Convenient

Servlets have an extensive infrastructure for automatically parsing and decoding HTML form data, reading and setting HTTP headers, handling cookies, tracking sessions, and many other such high-level utilities.

 

Powerful

Servlets support several capabilities that are difficult or impossible to accomplish with regular CGI. Servlets can talk directly to the Web server, where as regular CGI programs cannot, at least not without using a server-specific API. Communicating with the Web server makes it easier to translate relative

URLs into concrete path names, for instance. Multiple servlets can also share data, making it easy to implement database connection pooling and similar resource-sharing optimizations. Servlets can also maintain information from request to request, simplifying techniques like session tracking and caching

of previous computations.

 

 

Portable

Servlets are written in the Java programming language and follow a standard API. Consequently, servlets written for, say, I-Planet Enterprise Server can run virtually unchanged on Apache, Microsoft Internet Information Server (IIS), IBM WebSphere, or StarNine WebStar. In fact, servlets are supported directly or by a plug-in on virtually every major Web server. They are now part of the Java 2 Platform, Enterprise Edition , so industry support for servlets is becoming even more pervasive.

 

Secure

As servlets are written in java, servlets inherit the strong type safety of java language. Java's automatic garbage collection and a lack of pointers means that servlets are generally safe from memory management problems. In servlets we can easily handle the errors due to  Java's exception handling mechanism. If any exception occurs then it will throw an exception.

 

Inexpensive

There are a number of free or very inexpensive Web servers available that are good for “personal” use or low-volume Web sites. However, with the major exception of Apache, which is free, most commercial-quality Web servers are relatively expensive. Nevertheless, once we have a Web server, we can  add servlet support to it. This is in contrast to many of the other CGI alternatives, which require a significant initial investment to purchase a proprietary package.

 




Download Latest Java/J2EE eBooks, SCJP Dumps, SCWCD Dumps, Pega Tutorial, IBM WebSphere BPM tutorials and many more


If you need any urgent assistance on java-servlets-tutorial-for-beginners, kindly email your requirement to us at : info@javagenious.com or Contact-an-Expert. Our experts will try their best to solve your problem.

You can also subscribe to our newsletters on java-servlets-tutorial-for-beginners, to receive updates on java-servlets-tutorial-for-beginners,via email.Enter you email below:

Enter your email address:

Delivered by FeedBurner



Keyword Tags: java-servlets-tutorial-for-beginners tutorial,java-servlets-tutorial-for-beginners in java,Concepts of java-servlets-tutorial-for-beginners,Java,J2EE,Interview Questions,java-servlets-tutorial-for-beginners Examples


Comments:


Post Your Comment:

*

Yes, I would like to recieve email notifications on my reply.

Popular Posts:

 
Popular Downloads

SCJP 1.6 Dumps
JSP Interview Questions
Struts Interview Questions
Hibernate Interview Questions
SCWCD Dumps
SCBCD Dumps

Java/J2EE Tutorial
JMS Tutorials
seam richfaces tutorial
richfaces live demo
jquery example demo
JQuery Tutorial and Source Code
JSF Tutorial
XSL Tutorial
J2EE JMS
CORBA Applications
Java CERTIFICATION
SCJP 1.5
SCJP 1.6
SCWCD 1.5
SCBCD
Mis
Ajax autosuggest autocomplete from database
Struts forms and validation with webflow
Java Apache POI Examples
JDBC Tutorial
Oracle 9i & 10g
MYSQL Tutorial
php Tutorial
JQuery Examples
Upload Java File
JAXB Examples
PL-SQL Tutorial
Dojo AJAX
EJB Examples
Java IDE
Eclipse
NetBeans
IBM Rational Weblogic Workshop
Downloads
SCJP 1.6 Dumps
SCJP 1.5 DUMP
SCJP Material
SCWCD
Java Security
SCBCD Dumps
External Links
SUN Java
JOracle
IBM
PHP Certification
Technical Interview Questions
Amazon Interview Questions
Google Interview Questions
Microsoft Interview Questions
IBM Interview Questions
Yahoo Interview Questions
All Tutorials
php mysql tutorial
SCJP 1.5/1.6
SCWCD 1.5/1.6
Polymorphism
Thread Tutorial
Generics & Exceptions
Spring Struts Hibernate
Java Collections
MAP
SET
LIST
VECTOR
Advanced Java
Stateless Session Bean
Introduction to EJB
Stateful Session Bean
Java Design Patterns
HOME | FORUM | ABOUT | BLOGS | CONTACT-US