Home arrow Java arrow Creating Your First JSP Page

Creating Your First JSP Page

Have you ever wanted to develop JSP Web applications? This article will help you get all the tools you need installed on your computer, and walk you through the process of writing a simple application. It is excerpted from the book Beginning JSP 2 From Novice to Professional, written by Peter den Haan et al (Apress, 2004; ISBN: 1590593391).

Author Info:
By: Apress Publishing
Rating: 4 stars4 stars4 stars4 stars4 stars / 69
April 27, 2005
  1. · Creating Your First JSP Page
  2. · Downloading Tomcat
  3. · Trying It Out: Testing Tomcat
  4. · Creating Your First Web Application
  5. · Exploring a Brief History of Java and the Web
  6. · Java and the Web
  7. · The Java Community

print this article

Creating Your First JSP Page
(Page 1 of 7 )

WELCOME! In recent years, Java has risen to become one of the dominant development platforms for the Web, and knowledge of Java and often JavaServer Pages (JSP) is required for a wide variety of situations throughout the industry. You probably already knew that, and that’s why you’re reading this book right now.

In this book, we set out to make it easy for anyone of only modest computing skills to learn enough about Java and JSP to create Web applications using the latest technologies in this arena, such as JSP 2.0 and Tomcat 5.0 (you’ll learn what these are in just a few paragraphs).

The goal of this first chapter is to install all the tools on your machine that you’ll need to develop JSP Web applications. We’ll walk through the process of writing a simple Web application and discuss some fundamental principles of the Web itself, covering the role that Java and related technologies have to play.

Subsequent chapters of this book will gradually ramp up your knowledge of JSP and of Java as it pertains to JSP applications. By the end of the book, you’ll be confident enough to start writing your own JSP Web applications.

Installing the Software

Fortunately, all the software you’ll use throughout this book is available without charge. In this chapter, you’ll install the essentials for creating Java Web applications:

Java 2 Standard Edition Software Development Kit (J2SE SDK): Software developers use three different versions of Java: Java 2 Micro Edition (J2ME), Java 2 Standard Edition (J2SE), and Java 2 Enterprise Edition (J2EE). J2ME is used for developing applications for small devices such as phones or personal digital assistants (PDAs). It’s a stripped-down version that’s highly optimized for these devices’ limited capabilities. J2SE is the standard version of Java for developing everything else from games to business applications. J2EE is built on top of J2SE, adding a plethora of features geared toward applications for large businesses (so-called enterprises). All the extras included with J2EE can be downloaded separately and used with J2SE.

Apache Jakarta Tomcat:Tomcat is what’s known as a servlet container. In the Java world, a servlet container is responsible for receiving Web requests and passing them to Java Web applications. We’ll discuss servlet containers and Tomcat in greater detail later in the “Java and the Web” section.

We’ll provide instructions for installing these applications on Windows 2000/XP and Red Hat Linux. If you’re using a different version of Windows or a different distribution of Linux and you can’t figure out what’s going on from the instructions given, don’t panic; both of these applications come with their own installation instructions. In a pinch, you can simply refer to them.

Downloading Java Standard Edition

Sun Microsystems, the creator and maintainer of Java, makes Java available for download from its Web site. At the time of this writing, the latest version is 1.4.2, which you can find at the following uniform resource locator (URL):


This URL takes you to a page offering the various flavors available depending on the platform you use. You also have a choice between the Java Runtime Environment (JRE) and the SDK. The JRE is for folks who want to run Java applications but aren’t developing Java software, so you’ll want the SDK.

If you’re on Linux, download the RPM in the self-extracting file.

NOTE  Be sure to download the J2SE SDK, not the JRE.

Because Web sites are subject to change, and books sadly don’t change after they’ve been printed, these links may no longer work. In that event, visit http://java.sun.com and download the latest version of Java for your operating system that you can find. Sun does a pretty good job of providing help and instructions to get you this far.

Installing Java on Windows

The file you’ve downloaded is a self-extracting EXE file, so double-click it once it has been downloaded. You then need to enter the name of the folder where Java is to be installed. Choose something such as C:\java\jdk1.4, but if you install to somewhere else, be sure to note the location for future use. Now finish the installation, leaving any options at their default values.

NOTE  If possible, you should avoid using directory names that contain spaces (for example, C:\Program Files). This can cause subtle, difficult-to-troubleshoot errors in the future.

Installing Java on Red Hat Linux

The Red Hat Package Manager (RPM) file you downloaded is wrapped in a self-extracting binary format that you’ll need to execute before installation. Open a shell prompt to the location you’ve downloaded Java, and type the following:

chmod a+x j2sdk-1_4_2_02-linux-i586-rpm.bin

You’ll then see a long license. Read it carefully (wink), and then agree to it, at which point an RPM file will be extracted into the same directory. Before you can install it, you must become the root user by typing the following:


Once you’ve entered the root password at the prompt, you can then install Java by typing this:

rpm -U j2sdk-1_4_2_02-linux-i586-rpm

Of course, if you’ve downloaded a different version of Java, you’ll need to use that filename in place of the one shown here.

The RPM will install Java to the following path:   /usr/java/j2sdk1.4.2_02.

blog comments powered by Disqus

- Java Too Insecure, Says Microsoft Researcher
- Google Beats Oracle in Java Ruling
- Deploying Multiple Java Applets as One
- Deploying Java Applets
- Understanding Deployment Frameworks
- Database Programming in Java Using JDBC
- Extension Interfaces and SAX
- Entities, Handlers and SAX
- Advanced SAX
- Conversions and Java Print Streams
- Formatters and Java Print Streams
- Java Print Streams
- Wildcards, Arrays, and Generics in Java
- Wildcards and Generic Methods in Java
- Finishing the Project: Java Web Development ...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials