In: Computer Science
When you put a Servlet in a Web Application on the Tomcat/Glassfish server, how do you go about running this Servlet?
a. From the Browser’s URL(give path):
1. First we need to create a war file. So go to your application directory in cmd (Command-Prompt) and
run following command
jar cvf <directory-name>.war .
Include the last dot (.)
Here c - indicate Create .jar/.war file
Here v - indicate verbose
Here f - indicate jar/war file name.
For Example: jar cvf demo.war .
2.Now open browser and write
localhost:8080
If your web server is running on other machine then specify ip address of that machine instead of localhost.
3. In Apache Tomcat-
1. Go to manager app.
2. Here browse the war file created earlier.
3. Then Deploy it.
4. After deployment you can see the application running.
5. Now whatever URL you have specified in xml file give that url for running servlet.