Creating Dynamic Web Application using Servlets

1) Create a directory structure for application.


2) Create a java  file by extending Servlet interface from javax.servlet package and overriding its methods.

3) Open command prompt in the same directory and compile it and place the class file of in the classes folder of web application.

4) Now, create an html file, and place it in the public folder, out of any WEB-INF or any other folder.
index.html , if no other page is specified, is seen as default static web page to be executed on opening web-app.


5) Create a deployment descriptor (web.xml) and put it inside WEB-INF folder.


6) Now, create a .war file using the below commands : Firstly, open the command in the directory of the Public Folder. Now, type

jar -cf appname.war *
war file combines all the contents of a web application so that it takes less time to transfer file from client to server.

5) Start the server ,if already running, deploy your application access it using Web browser.

Leave a Reply

Your email address will not be published. Required fields are marked *