This post will give you description about how you can run your project using Apache Tomcat Server.
I would like to define these terms before proceeding:
- Apache Tomcat Server(Jakarta Tomcat): It is an open source web server and servlet container developed by the Apache Software Foundation (ASF). It implements the Java Servlet and the JavaServer Pages (JSP) specifications and provides a pure Java HTTP web server environment for java code to run.
- JavaServerPages(JSP): It is a technology that helps in creating dynamically generated web pages.
Install Apache Tomcat
At the time of installation, it will by-default recognize JRE path.
(under installed java location directory)
- APACHE TOMCAT
- MONITOR TOMCAT
An icon will appear on the taskbar, this icon will automatically appear after following above step:
Click on that icon and START TOMCAT, you can see the following dialog box:
Now open Mozilla Firefox(or any other browser)
Type http://localhost:8080/ on address bar and press enter.
The same can be seen here:
It will show tomcat, as shown in above window.
(if not, then try again, may be a problem in installation or you’re not following above steps correctly
Now, go to:
- Programs Files
- Apache Software Foundation
(or navigate where you have installed APACHE TOMCAT)
Open web-apps and “copy your project” or “make new folder”, which you want to run in JSP.
Now, go back :
- Copy Web-inf from root
- Paste this “web-inf” in your project folder i.e. amit2012PROJECT
Create a text file and name it as first.jsp, use the code shown below:
<html> <head> <title>blog post:ApacheTomcatServer</title> </head> <body> <%-- START --%> <% out.println("UserName = amit2012, "); out.println("Running first program in JSP."); %> <%-- END --%> </body> </html>
It includes HTML tags and encloses a JSP scriptlet which is a fragment of Java code that is run when the user requests the page.
Now for running your folder [ Eg. amit2012PROJECT as shown above]
http://localhost:8080/foldername.extension in any WebBrowser i.e:
The Project will run successfully, as shown below:
Now, you can successfully try running JSP with ApacheTomcatServer.