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...

Easy 12 steps to solve standard Rubik's Cube (3*3*3)( Fully explained with solution of flip doubts and all )

Easy 12 steps to solve standard Rubik's Cube (3*3*3)  First of all , let us tell you in brief about Rubik's cube . It contains  Six faces of Six different color {Blue , Green(opposite to blue) , red , orange (opposite to red) , white ( usually taken as reference color) and yellow (opposite to white) }  To make you easy ,we have given easy name for the layers and  moves of cube : (NOTE : A Center color of cube never moves so below mentioned  color facing towards you , to the right , left , up, down  and back is a center color which is in the middle of each layer )  FRONT LAYER F ( Front): The front layer of cube is facing towards you . If F  move is to be done then , move the front layer in clockwise  direction . F' ( Front prime ): If F' move is to be done then , move the front layer in anti-clockwise direction BACK LAYER B ( Back ) : The back layer is just opposite to the front  layer.  Suppose , if we take blue as...

What is a Country? देश भनेकाे के हाे?

Yesterday, on January 13, Nepal's Coat of Arms was updated to add Kalapani and Limpiyadhura as in the new Political map. In this context, we today discuss on what actually 'a country is for it's citizen.' देश भनेकाे के हाे? What is a Country? जनताका लागि देश के हो ? जनताका लागि देश संविधान, कानुन, नागरिकता, सिमाना र झन्डा मात्र हो ? होइन । जनताका लागि देश राजधानी, त्यसबीच ठडिएको दरबार र त्यसको गजुर हो ? होइन । जनताका लागि देश भनेको सरकार हो ? होइन । जनताका लागि देश निर्वाचन क्षेत्र मात्र हो ? हुँदै होइन । त्यसो भए जनताका लागि के हो त देश ? जनताका लागिदेश चार सिमानाभित्रको माटो मात्र होइन । योसँगै जोडिने भावना, प्रेम, ऊर्जा र सपनाहरूको बगैंचा हो । जनताका लागि देश आशा हो । जनताका लागि देश खेतमा झरेको पसिनाको बियाड हो । आन्दोलनहरूमा सडकमा पोखिएको रगत हो । आफ्ना सपनाहरूको कविता हो । जस्तो, एउटा शिशुका लागि आमाको काख । जस्तो, भर्खर हिँड्दै गरेको एउटा बालकका लागि पिताजीको हात । एउटा यात्रीका लागि देश बाटो हो, जसमाथि ऊ आफ्ना पैतालाका डोबहरू छोड्छ र गन्तव्यतिर बढ्छ । देश भनेको ...