Services | Updates | Contact
Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
Comments in Jsp
In a jsp we should always try to use jsp- style comments unless you want the comments to appear in the HTML.
 
Receiving and sending a request to UDP server in Java
Here, you will know how to receive and send messages by UDP server.
 
More Tutorials...


    Loan Information     Struts     Open Source

Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

 
 
Java Servlets

 
Comments
 
 

 

Java Servlets - Downloading and Installation

                         

  Java Servlets are server side components that provides a powerful mechanism for developing server side of web application. Earlier CGI was developed to provide server side capabilities to the web applications. Although CGI played a major role in the explosion of the Internet, its performance, scalability and reusability issues make it less than optimal solutions. Java Servlets changes all that. Built from ground up using Sun's write once run anywhere technology java servlets provide excellent framework for server side processing.

   With Java servlets web developers can create fast and efficient server side application   and can run it on any Servlet enabled web server. Servlets runs entirely inside the Java Virtual Machine. Because the Servlet is running on the server side, it does not depend on browser compatibility. I just send the result in html formats.

    Java Servlets have a number of advantages over CGI and other API's. They are:

  1. Platform Independence
    Java Servlets are 100% pure Java, so it is platform independent. It can run on any Servlet enabled web server. For example if you develop an web application in windows machine running Java web server. You can easily run the same on apache web server (if Apache Serve is installed) without modification or compilation of code. Platform independency of servlets provides a great advantage over alternatives of servlets.
  2. Performance
    Due to interpreted nature of java, programs written in java are slow. But the java servlets runs very fast. These are due to the way servlets run on web server. For any program initialization takes significant amount of time. But in case of servlets initialization takes place very first time it receives a request and remains in memory till times out or server shut downs. After servlet is loaded, to handle a new request it simply creates a new thread and runs service method of servlet. In comparison to traditional CGI scripts which creates a new process to serve the request. This intuitive method of servlets could be use to develop high speed data driven web sites.
  3. Extensibility
    Java Servlets are developed in java which is robust, well-designed and object oriented language which can be extended or polymorphed into new objects. So the java servlets takes all these advantages and can be extended from existing class the provide the ideal solutions.
  4. Safety
    Java provides a very good safety features like memory management, exception handling etc. Servlets inherits all these features and emerged as a very powerful web server extension.
  5. Secure
    Servlets are server side components, so it inherits the security provided by the web server. Servlets are also benefited with Java Security Manager.

Java Servlet API

Java Servlet API contains two core packages:
  • javax.servlet
  • javax.servlet.http

     Servlets implement the javax.servlet.Servlet interface. The javax.servlet package contains the generic interfaces and classes that are implemented and extended by all servlets. While the javax.servlet.http package contains the classes that are used when developing HTTP - specific servlets. The HttpServlet is extended from GenericServlet base class and it implements the Servlet interface. HttpServlet class provides a framework for handling the HTTP requests.

The  javax.servlet.Servlet defines five methods:

  1. service() metho called by servlet to handle the client request in a new thead. service() methos accepts ServletRequest and a ServletResponse ohjects as parameters. ServletRequest object represents the client request. It contains the data sent in name/value pairs. ServletResponse object is used to send the response to the client.
  2. init() is called once when servlet is loaded. It is a good place to initialize global variables. This methos accepts ServletConfig as parameter which provides initialization arguments for the servlet.
  3. getServletConfig() returns the ServletConfig object passed to init().
  4. destory() is called when wervlet is unloaded from memory. This is a good place to clean up any resources(such as open files or database connections).
  5. getServletInfo() returns a string with version, copyright informations etc.

 

Installing Servlets

The servlet run inside a Web Server program. After it has been compiled, it must be installed onto Web Server in order to test it. Thus we have to follow the following steps:
  1. Install the servlet in a hosting server
  2. Request the servlet through web browser.

Java servlets are supported by a number of web servers. Java Web Server from JavaSoft was first servlet enabled web server. Now a days a number of web server supports java servlets. In this article we will use Java Web Server, whose evaluation copy can be downloaded from http://jserv.javasoft.com . In order to compile your servlet you also need Java Servlet Development Kit (JSDK) which is available at same place.

 

Installing on Windows95 and Win NT

  1. Download the distribution of Java Web Server from http://www.javasoft.com/products . Distribution is in the form of self-extracting file.
  2. The Java Web Server can be installed in any directory, so you can choose your favorite directory for installation. Move the downloaded file into your favorite directory.
  3. To begin the installation just double-click on the self-extracting file and the file extract itself and then installation begins.
  4. Follow the instruction and complete the installation.

To run the Web Server go to your installation directory and then to bin directory and then double click httpd.exe. To test the Web Server open your browser and type http://localhost:8080 in address bar and then press enter. Browser should display default index.html into browser.
 
Links To Servlets Tutorials

                         

Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

16 comments so far (post your own) View All Comments Latest 10 Comments:

It is very satisfied by me.. becuz i am new to java progrmming.. it is very useful to me
thanking u

Posted by Ramakrishna on Sunday, 05.11.08 @ 16:07pm | #59334

Hi
I am using ORACLE in my system.
i want to run this using the servlet program
but it is not connect to the Oracle. The remaing code is executed except this connection

so please give the answer for my question with example

Posted by Ramakrishna on Sunday, 05.11.08 @ 16:05pm | #59333

i was really satisfied using roseindia.com,

Posted by premsagarreddy on Saturday, 05.3.08 @ 17:38pm | #58424

i want to know about interview quastion and answere

Posted by jeetendra on Monday, 04.28.08 @ 18:47pm | #58068

sir, i need the information of best books for servlets,jspand jdbc

Posted by s.raviprakash reddy on Wednesday, 03.19.08 @ 20:34pm | #53344

Please send me notes for servlets (J2ee) to my mail id

Posted by sankar on Wednesday, 03.12.08 @ 12:31pm | #52448

good morning sir ,
i m soni garikapati i just want to servlet notes regarding to you
plz try to send it to my email
thanking you.....

Posted by soni garikapati on Thursday, 02.21.08 @ 11:28am | #49284

I am sadananda nayak . I hava completed my MCA in 2007 from BPUT Univ. ORISSA.
Now I am searching job for java fresher.

Posted by sadananda nayak on Wednesday, 02.13.08 @ 16:03pm | #48142

good morning sir ,
i m satyam yanala i just want to servlet notes regading to you
plz try to send it to my email
thanking you.....


Posted by satya on Monday, 01.28.08 @ 17:19pm | #46406

good morning sir ,
i m sumit kumar i just want to servlet notes regading to you
plz try to send it to my email
thanking you.....

Posted by sumit on Tuesday, 01.15.08 @ 18:42pm | #45270

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.