Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · ASP.NET Newsletter Application · Web Hosting Plans · Faisal Khan's Blog · Contact
Search Stardeveloper.com
Newsletter
Enter your email address to receive full length articles at Stardeveloper:


Article Categories
.NET  .NET
  ASP (16)
  ASP.NET (43)
  ADO (16)
  ADO.NET (11)
  COM (6)
  Web Services (4)
  C# (1)
  VB.NET (3)
  IIS (2)

J2EE  J2EE
  JSP (15)
  Servlets (9)
  Web Services (1)
  EJB (4)
  JDBC (4)
  E-Commerce (1)
  J2ME (1)
  Products (1)
  Applets (1)
  Patterns (1)

Main Category  Other
  Website Maintenance (3)
Log In
UserName Or Email:

Password:

Auto-Login:

Hosted by Securewebs.com
 
Home : J2EE : JSP : Installing, Configuring, & Running Tomcat 6.0 Servlet Container on Microsoft Windows, and Developing & Running your first JSP Page
 
Read full length articles at Stardeveloper using Twitter Follow on Twitter Facebook Facebook fan page Email Get Articles via Email RSS Get Articles via RSS Feed

Installing, Configuring, & Running Tomcat 6.0 Servlet Container on Microsoft Windows, and Developing & Running your first JSP Page

by Faisal Khan.

Overview
In this article I'll introduce what is JSP and why at all do we need to learn it. Then I'll move on to describe the installation of open source Servlet Container/JSP Engine, Tomcat. Once done, I'll explain the steps of running your first JSP page. Note that I am not going to describe the structure of a JSP page and what are the different features of JSP, I'll cover them in a separate article.

What is JSP?
JSP stands for 'Java Server Pages'. These are pages which are used to serve dynamic content to the user using logic and data (XML, Database etc) on the server side. JSP is a part of J2SE (Java 2 Standard Edition) and along with Java Servlets and Java Beans is used to develop efficient, scalable and secure web applications in quick time.

Why bother with JSP when ASP is already here?
Nice question, first of all ASP is not the only solution out there which supports rapid web application development, there are others like PHP, Perl, ColdFusion etc. JSP is different from all of them because :

  • JSP uses Java. Java is by far one of the most popular programming languages on the web. Its simpler syntax and 'write once run anywhere' capability makes it THE server side programming language of choice. So JSP pages and Java applications that you create will run on almost all major operating systems e.g. Windows, UNIX, Mac etc. You don't need to create separate apps for separate platforms.
  • JSP is part of J2EE. J2EE (Java 2 Enterprise Edition) is one of the most popular models used to develop Enterprise level applications. J2EE is supported by software giants like Sun Microsystems, BEA, Oracle, IBM etc. So once you learn to program JSP, you can extend your skills to learn other Java technologies to become what is called, an Enterprise Software Developer.
  • Networking is built into Java. Java's inherent support for networking makes it an ideal langauge for the internet.

I can continue to write more and more reasons as to why to use Java (JSP) but then it will make my article longer than I would like, so I suffice with the above features. Once you'll learn Java (JSP), you'll come to know what I mean when I say 'Java is the best language for the internet'.

Continue reading to see the basic steps required in the installation of Tomcat 6.0 Servlet Container / JSP Engine. I'll be using Tomcat in the later articles and tutorials on 'Server Side Java' so you need to have it installed on your system.

Following is a list of topics we'll cover in this article :

You'll need to have JDK 1.6 (or simply 'JDK 6', as it is called on Sun's download page) installed on your system in order for Tomcat 6.0 to work properly. If you don't already have it, you can get it from java.sun.com.

Obtaining Tomcat 6.0
Tomcat 6.0 is an open source and free Servlet Container and JSP Engine. It is developed by Apache Software Foundation and is available for download at http://tomcat.apache.org, or more specifically at http://tomcat.apache.org/download-60.cgi. Choose the latest Tomcat 6.0 version. Currently Tomcat 6.0.14 is the latest version. Once you have downloaded Tomcat 6.0, proceed to the next step.

Installing Tomcat 6.0
Unzip the file to a suitable folder. In Windows, you can unzip it to C:\ which will create a directory like C:\apache-tomcat-6.0.14 containing Tomcat files.

Now you'll have to create two environment variables, CATALINA_HOME and JAVA_HOME. Most probably you'll have JAVA_HOME already created if you have installed Java Development Kit on your system. If not then you should create it. The values of these variables will be something like :

  • CATALINA_HOME : C:\apache-tomcat-6.0.14
  • JAVA_HOME : C:\Program Files\Java\jdk1.6.0_03

To create these environment variables in Windows 2000 or Windows XP, go to Start -> Settings -> Control Panel -> System -> Advanced -> Environment Variables -> System variables -> New. Enter the name and value for CATALINA_HOME and also for JAVA_HOME if not already there.

Under Windows 95/98, you can set these variables by editing C:\autoexec.bat file. Just add the following lines and reboot your system :

SET CATALINA_HOME=C:\apache-tomcat-6.0.14
SET JAVA_HOME=C:\Program Files\Java\jdk1.6.0_03

Running Tomcat 6.0
Ok now, lets start Tomcat by running the C:\apache-tomcat-6.0.14\bin\startup.bat batch file. Tomcat server will start and print some status messasge. Now point your browser to http://localhost:8080 and you should see the default Tomcat home page. To shutdown the server run C:\apache-tomcat-6.0.14\bin\shutdown.bat batch file.

Tomcat starting up...


Apache Tomcat home page on localhost

Go to C:\apache-tomcat-6.0.14\webapps\ folder and create a new directory with the name of "star". You can give it any name you want but for this example we'll stick with "star".

Now create a new file and save it as 'index.jsp' in the "star" directory created above. Copy the following text into 'index.jsp' file and save it :

<html>
<head>
	<style>p { font-family:tahoma; font-size:14pt; }</style>
</head>
<body>

<%
	String name = "Faisal Khan";
%>
<p>Hello <%= name %>!</p>

</body>
</html>

 ( 1 Remaining ) Next

Comments/Questions ( Threads: 20, Comments: 42 )
    Contains 1 or more replies by the Author of this Article.
    Contains 1 or more replies by Faisal Khan.

  1. installation of apache tomcat-6.0.14
  2. After installing Tomcat 6.0 using this Tutorial, problem with Displaying Records Tutorial
  3. getting error while running startup.bat file ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  4. actually what is application and web servers? ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  5. xml file generation ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  6. data base connection with java bean and and use this connection in jsp,servlet? ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  7. Servlets ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  8. Editing The Tomcat Default page ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  9. Error when am editing server.xml ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  10. need help ( 2 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  11. How to count the number of Users visited by Website ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  12. Running Tomcat 5.0.27-beta for the first time ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  13. How to generate .jsp file ( 2 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  14. javax.mail error ( 1 Reply )
  15. description The requested resource (/star/index.jsp) is not available. ( 3 Replies ) This thread contains 2 replies by the Author of this Article. This thread contains 2 replies by Faisal Khan.
  16. Same Tomcat problem ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  17. run .jsp file ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  18. Connecting Database file ( MS Access )with JSP , using Tomcat Server ( 2 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  19. Need help: Tomcat install problem.... ( 1 Reply )
  20. HELP: TOMCAT INSTALL PROBLEM ( 3 Replies ) This thread contains 2 replies by the Author of this Article. This thread contains 2 replies by Faisal Khan.

Post Comments/Questions

In order to post questions/comments, you must be logged-in. If you are not a member yet, then signup, otherwise login. Once you login then come back to this page and you'll see a form right here which will allow you to post comments/questions.

Please note, one of the benefits of signing up is to be notified immediately by email everytime you receive a reply to the thread you have subscribed.

 
© 1999 - 2010 Stardeveloper.com, All Rights Reserved.