Creating web application for static resources
- Create a web application structure as follows.(To know more about structure of web application )
- Create static.html as follows
- Copy static.html page into WebApp(WEB-ROOT) directory.
- Final WebApp structure
- Create a war(web archive) using the jar command.
- In order to run a web application, the web application must be deployed in the container.
We must copy the war file in webapps directory of tomcat.
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps
- Accessing web application static resource.Open the browser and type the following URL in the address bar
<html> <head> <title>Servlets</title> </head> <body> <h1>Welcome to Servlets</h1> </body> </html>
Note:Instead of copying the war file to webapps we can copy the exploded directory structure of the web applications in webapps directory.