Open In App

Web Container and Web Application Project Setup in Java

Last Updated : 02 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Web container is a web server component that interacts with the Java Servlets. This processes the requests to the requested servlet while checking the required access rights of the URL.

Web-Container

Web container

The functioning is as follows:

  1. The web client requests a URL to the web server.
  2. The web container in the server maps it to the requested servlet.
  3. The servlet then loads the methods and functions.
  4. The servlet processes the response to the container, which finally reaches the client through the server.

To set up Tomcat Container on a machine

Tomcat is an open-source Java servlet container that incorporates varying APIs and Java specs. If you are aware of HTTP, it sends and receives simple data over the server. But what if we need to use a dynamic site that makes use of dynamic data, then we would be requiring some servlet in addition to HTTP. This integration of HTTP and Java Servlet together constitutes Tomcat.

Steps to download and install tomcat on Windows 10

Step 1. Open this link and install the version of tomcat which maps your system.

Step 2. Once the installation starts, click on Next and click agree for permission.

Apache Tomcat Setup.

Step 3. Under the components tab, click Next.

Adding the Components in the Tab

Step 4. On the configuration tab, enter username and password and click Next.

Step 5. Click Next on JVM path setup and click Install.

Setting Path while Installing

Web Application Project Structure

The structure of a web application follows a directory structure, fully accessible to the application’s document root. The root contains JSP, HTML, CSS and JS files.

  • The root directory contains a META-INF and a WEB-INF folder.
  • The META-INF provides the information about the metadata of the JAR contents.
  • The WEB-INF contains all the other required information which is not accessible in the public document tree. It includes the directory for servlet and its other classes under /classes/* hierarchy and XML based deployment descriptors under /web.xml and /sun-web.xml.

The Hierarchy is as follows:

Project Structure


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads