Run your first JSP program in Apache Tomcat Server


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.

Step1

Install Java.

Step2

Install Apache Tomcat
At the time of installation, it will by-default recognize JRE path.
(under installed java location directory)

Step3

Now Go-To:
  1. Start
  2. Programs
  3. APACHE TOMCAT
  4. MONITOR TOMCAT

Step4

Click on that icon and START TOMCAT

Step5

Now open Mozilla Firefox(or any other browser)

Step6

Type http://localhost:8080/  on address bar and press enter.

Step7

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

Step8

Now, go to:
  • C:drive
  • Programs Files
  • Apache Software Foundation
  • tomcat
  • web-apps
(or navigate where you have installed APACHE TOMCAT)

Step10

Open web-apps and “copy your project” or “make new folder”, which you want to run in JSP.
Example: amit2012PROJECT
Now, go back :
  • Tomcat
  • Root
  • Copy Web-inf from root
  • Paste this “web-inf” in your project folder i.e. amit2012PROJECT

Step11

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.

Step12

Now for running your folder [ Eg. amit2012PROJECT as shown above]
http://localhost:8080/foldername.extension in any WebBrowser i.e:     
http://localhost:8080/amit2012PROJECT/first.jsp
The Project will run successfully                                                   
Run your first JSP program in Apache Tomcat Server Run your first JSP program in Apache Tomcat Server Reviewed by Wanem Club on October 12, 2017 Rating: 5

No comments:

Powered by Blogger.