In this session, you will learn to:
Deploying Web applications
Objectives
iNET Java/JSP/Servlet Course
Deploying Web Applications
A web application is defined as a hierarchy of directories and files in a standard layout.
You can access this hierarchy in an unpackaged form or packaged form.
In the unpackaged form, each directory and file in the hierarchy exists in the web application directory structure separately.
In the packaged form, the hierarchy is available as a Web Archive, or WAR file.
The unpackaged structure is useful during the development of the web application, while the packaged structure is used when you distribute your application.
iNET Java/JSP/Servlet Course
Each Web application is given a unique context root, which is the name of the Web application as seen by the browser.
The top-level directory of the web application hierarchy is also known as the context root of the application.
Context root directory is immediately followed by the WEB- INF directory.
The classes, lib and tags directories are placed immediately inside the WEB-INF directory.
To facilitate creation of a WAR file in the required format, you are required to arrange the directory and files of your Web application in the appropriate format.
Structure of the Web Application
iNET Java/JSP/Servlet Course
The directory and files contained in the context root of the Web application are:
*.html, *.jsp, image files, and style sheets /WEB-INF/web.xml
/WEB-INF/classes/
/WEB-INF/lib/
Structure of the Web Application (Contd.)
iNET Java/JSP/Servlet Course
A WAR file is a JAR file containing the Web application structure in a portable and compressed form.
When you build a new project, a dist folder is created in the project folder that you have created in NetBeans IDE 5.5.1.
The .war file is created in the dist folder that you can use for deploying on the Application server.
WAR File
iNET Java/JSP/Servlet Course
Challenge
Which of the following directories contains any Java class files required for your application?
a. classes b. lib
c. Tags d. TLD
Answer:
b. classes
iNET Java/JSP/Servlet Course
Challenge (Contd.)
Which of the following directories is NOT placed directly inside the WEB-INF directory?
a. classes b. lib
c. tags d. jar
Answer:
d. jar
iNET Java/JSP/Servlet Course
Challenge (Contd.)
Which of the following is a JAR file containing the Web application structure in a portable, and compressed form?
a. TLD b. WAR c. web.xml d. JSP
Answer:
a. WAR
iNET Java/JSP/Servlet Course
Challenge (Contd.)
Which of the following directories immediately follows the context root directory of the application?
a. classes b. lib
c. WEB-INF d. tags
Answer:
c. WEB-INF
iNET Java/JSP/Servlet Course
Challenge (Contd.)
Which of the following directories contain the web.xml file ?
a. classes b. WEB-INF c. lib
d. Tags
Answer:
b. WEB-INF
iNET Java/JSP/Servlet Course
In this session, you learned about:
Deploying Web Applications
Summary