Servlets - SPLessons

Servlet Flow Of Execution

Chapter 8

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

Servlet Flow Of Execution

Servlet Flow Of Execution

shape Description

Servlet Flow Of Execution, As discussed in the previous chapter that how to start working with an IDE. Now this chapter describes Servlet Flow Of Execution like how to start the program and what is the required files needed and what is the functionality of every line in the code. Some time developments may require other files such as HTML, XML. Create the following deployment directory structure or packing directory structure to combine multiple web resource program into a single unit.

shape Conceptual

Following is the conceptual figure which describes more about the structure of Servlet Flow Of Execution.

As shown in the above figure while developing an application some rules need to be follow they are all the Java files needs to place under source folder, all the XML, HTML, CSS files should be placed under WEB-INF, By using build path all the jar files needed to import into the library.

Create XML

shape Description

The XML is a Platform Independent and Language Independent.The main use of XML is that user can use it to take data from a program, convert it into XML then share that XML with native programs and platforms. User can communicate between two platforms which are generally very difficult.

Develop XML program (web.xml) file having the servlet programs configuration. All servlet programs must be configured in the web.xml file. Make sure that servlet name should be same in both ans . URL pastern should me match with HTML form action name.

All jar files which are useful for the program are put in lib folder. Here servlet jar file is available in

C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\lib

Create servlet program

shape Description

Develop servlet program ( Save it in WEB-INF/classes folder of Web apps.

Tomcat server

shape Description

  • Start tomcat server (Tomcat 6.0\bin\tomcat6)
  • Deploy the above root folder web application
  • Perform the deployment of web application
  • Test the web application


shape Key Points

  • Servlet Flow Of Execution – All Java files will be kept under Java resources.
  • Servlet API needs to be imported while doing coding.
  • Servlet API will consist of all the classes and interfaces .