Skip to main content

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                                                   

Comments

Popular posts from this blog

How to Remove Powered by Blogger – Attribution Widget?

In this article, I will be demonstrating how to remove or hide attribution widget ‘Powered by Blogger’ in footer of blogger blogspot blogs.  Before going to the process,  backup your blogger template , while editing html code if anything goes wrong or template modified design doesn’t work or looks good you can restore from backed up template.  Here I have demonstrated you two methods for removing attribution widget. Some blogger templates may not support method 1 then you need to follow method 2 for successfully removing attribution widget. Method 1: Remove ‘Powered by Blogger’ by unlocking Attribution widget Step 1 : Go to your blog “Template” | click on “Edit HTML”. Step 2 : Here on drop-down “jump to widget” option and select Attribution 1 as shown below Step 3: After selecting Attribution 1 widget you will be able to see this line <b:widget id=’Attribution1′ locked=’true’ title=” type=’Attribution’>  on your blogger template. Step 5: Once done click on...

The four yugas (Era or Epoch) in Hinduism

A yuga is the period-of-time or ages. In Hinduism, the Chatur-yuga (Four-Yuga) are large time periods characterizing and defining humans as well as social development on the earth. There are four different yugas, (Chatur---> Four) and each of them have their own feature in history. Let's see their names: Satya Yuga (सत्य युग) Treta Yuga (त्रेता युग) Dwapara Yuga (द्वापर युग) Kali Yuga(कली युग) Let's learn briefly on them: 1. Satya Yuga: It is also called as Krita yuga, which is the first of the yuga. Satya means truth. It lasted for 17,28,000 years or 4800 Divine years. It is the truth or golden age, where all humans were good and very religious. It was the first and best yuga without crime and all humans were kind and friendly. It is called Krita Yuga as there was one religion and all men were saintly. Humans used to be 33 feet in height and average human lifespan was of 1,00,000 years.   The bull of   Dharma  symbolizes that morality stood on all four legs durin...

How to get Google Assistant on your Windows, Mac, or Linux Machine

Google Assistant is Google’s answer to Amazon’s Alexa smart home assistant. Initially only available with limited functionality in the Google Allo application, Google Assistant later rolled out with the Google Home and Pixel smartphones to bring the full power of Google’s assistant to consumers. After a few months of waiting, smartphones running Android 6.0+ also received Google Assistant, and just a few days ago Google launched the Google Assistant SDK which allows Assistant to be run on basically any platform. Today, we will show you how to install Google Assistant onto your Windows, Mac, or Linux machine using Python. Note: at this point in time, this is purely for educational purposes. There’s no fancy GUI for you to play with, and installing Assistant requires you to use the command line. Get Google Assistant on Windows/Mac/Linux Machines Requirements: Python 3 You’ll need to have Python installed no matter whether or not you are using W...