×

Uh-oh, it looks like your Internet Explorer is out of date.

For a better shopping experience, please upgrade now.

Beginning JSP Web Development
     

Beginning JSP Web Development

5.0 1
by Apress, John Timney, Sathya Narayana Panduranga, Meeraj Moidoo Kunnumpurath, Perrumal Krishnaraj
 
The emergence of Java APIs for server-side development has led to a rapid and growing acceptance of Java in the enterprise. As a result, web developers are tasked with creating Java web applications that are informative and interactive. Java Server Pages (JSP) is a recent extension (currently at v1.0) to the Java platform that promises to become the standard tool for

Overview

The emergence of Java APIs for server-side development has led to a rapid and growing acceptance of Java in the enterprise. As a result, web developers are tasked with creating Java web applications that are informative and interactive. Java Server Pages (JSP) is a recent extension (currently at v1.0) to the Java platform that promises to become the standard tool for intranet and web application development.

Java Server Pages allows developers to easily create dynamic, interactive web pages by embedding scripts directly into HTML and XML. These scripts make use of Java bean components. By separating presentation code from the generation of dynamic content, JSP also allows web designers to change the presentation of applications with minimal Java programming knowledge. Java Server Pages extend the functionality of web servers by performing server-side tasks such as HTML form processing, database queries, and report generation. Using Java Server Pages, developers can quickly create powerful intranet and web applications that incorporate enterprise resources such as databases, networked servers and distributed objects. JSP also offers numerous advantages over existing CGI scripting techniques, including portability, reusability, session tracking, performance, and ease of development.

Product Details

ISBN-13:
9781861002099
Publisher:
Apress
Publication date:
08/31/2001
Series:
Beginning Ser.
Edition description:
2001
Pages:
400
Product dimensions:
(w) x (h) x 0.07(d)

Read an Excerpt

Chapter 1: Starting Web Programming

Java has enjoyed a tremendous growth in use among web developers over the past few years to become one of the Web's pre-eminent development platforms. In fact, Java has become such a major player so rapidly that many in the industry aren't really sure exactly what Java does or how it works; they just know they need to learn it fast. If you fall into this category, keep reading - you're about to get some answers.

The goal of this chapter is to get all the tools installed on your machine that you'll need to develop Java web applications. We'll also go through the process of writing a simple Java web application as well.

At the end of the chapter, I've also included some optional material that explains a little about how the web itself works, and Java's role in the web.

Installing the Software

The first step to writing Java web applications is installing the necessary software; let's get to it!

Installing Java

The first thing you need is the Java software development kit:
  • Download Java. Point your web browser to http://java.sun.com/j2se/. You're looking for the latest version of the "Java 2 SDK, Standard Edition", disregarding any beta versions that may be available. As of this writing, the latest version is 1.3.

  • Install Java. After your browser finishes sucking down Java, execute the file that you've downloaded. For version 1.3 on Windows the installer's default folder (or directory) for the Java is C:\jdk1.3, but feel free to install it wherever you want (however, substitute your custom path for C:\jdk1.3 wherever you see it in this book).

Note that in these instructions and throughout the rest of the chapter I use the Windows notation for paths. To make these into Unix paths, substitute forward slashes (/) instead of back slashes (\) and remove the drive prefix at the beginning of the path - for example, C:\jdk1.3 becomes /jdk1.3.

Installing Tomcat

You've now got Java, but for creating web applications, we'll need one more tool: 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. (For the curious, see the history lesson at the end of this chapter to learn exactly why it's called a servlet container.)

  • Download Tomcat. Tomcat's home is http://jakarta.apache.org/tomcat/. Surf on over there and grab the latest version of Tomcat 4.x (as of this writing, it's Tomcat 4.0 beta 5).

  • Extract Tomcat. You may extract the Tomcat archive into any location you desire; we suggest that you extract it into C:\, which will place the files in a folder called something like C:\jakarta-tomcat-4.0-b5. (The exact folder will depend on which version of Tomcat 4.x you downloaded; this is the correct folder for beta 5.)

Configuring Your Environment

That's the software installed; we're nearly done now. However, you do need to set up your computer's environment so that Tomcat knows where it can find the various bits of software we need such as the Java software development kit.

To do this you need to set or modify several environment variables. We'll look at how to do this in a moment; first, let's see which variables we need to set:

  • JAVA_HOME tells Tomcat where it can find the Java software development kit; you must set it to the folder where you installed this, such as:

    C:\jdk1.3

  • CATALINA_HOME needs to point to the folder where you installed Tomcat, such as:

    C:\jakarta-tomcat-4.0-b5

  • CLASSPATH is used to help the Java software find extra bits of program code; it contains a list of places to look, separated by semicolons (;) on Windows or colons (:) on Unix. We need to include a file called servlet.jar, which can be found in Tomcat's common\lib folder this contains various bits of useful code that we'll need in later chapters. So, if you're on Windows and have been following our recommendations so far you've set CLASSPATH to:

    C:\Jakarta-tomcat-4.0-b5\common\lib\servlet.jar;.

  • PATH is used by your operating system to find programs you want to run; like CLASSPATH, it consists of a list of places to look separated by semicolons (on Windows) or colons (on Unix). You'll find that PATH is already set but you need to add the C:\jdk1.3\bin folder to the list. For example, on Windows your PATH might currently be:

    C:\WINDOWS;C:\WINDOWS\COMMAND

    which would need to be changed to:

    C:\WINDOWS;C:\WINDOWS\COMMAND;C:\jdk1.3\bin
So, let's move on to seeing how you actually set these environment variables.

Setting Environment Variables On Windows 2000

Let's start by seeing how to do so on Windows 2000:
  1. Go into the Control Panel and open up the System control panel application.

  2. You should have a window entitled System Properties on your screen; select the Advanced tab, and click on the Environment Variables button:

  3. A new window named Environment Variables should have opened. Click on the New button in the System Variables section.

  4. The New System Variable window should now be on your screen. Enter JAVA_HOME for as the name and the path to your JDK (such as c:\jdk1.3) for the value, as shown below...

Meet the Author

Jayson Falkner is a full time student at the University of Miami pursuing a degree in Information Technology. He has been programming in Java for the past two years and specializes in Servlets and JSP. Jayson is the CTO of Amberjack Software LLC and webmaster of JSP Insider. Jayson is an avid supporter of the open-source community and regularly contributes to various Java and JSP related projects. He may be reached at Jayson@jspinsider.com or by visiting his on-going efforts to provide good free information to the JSP community at http://www.jspinsider.com.

In his late teens Ben Galbraith was hired by a Silicon Valley computer manufacturer to develop Windows-based client-server applications. In 1995, Mr. Galbraith began developing for the web and fell in love with Unix, VI, and Perl. After some years as an Internet consultant, Mr. Galbraith now leads the Java development team at an insurance company in Salt Lake City. He regularly lectures, evangelizes and gives classes on Java technology.

Romin Irani works as a Senior Software Engineer with InSync Information Systems, Inc in Fremont, California. He has a Bachelors degree in Computer Engineering from University of Bombay, India. At InSync Information Systems, he was in the design and development team for a distributed eProcurement application which used a variety of J2EE technologies. His primary skills and interests lie in J2EE Technologies especially JSP/Servlets, Java-XML and Web Services.

Casey Kochmer's professional programming experience spans the past 11 years. Now actively promoting JSP, Casey is a co-founder of JSPInsider.com, a web site devoted to technical support for programmers making the jump to this development environment. Casey is also President of Amberjack Software LLC.

Perrumal Krishnaraj is a Sun Certified Java Programmer, founder and director of Adarsh Softech a consultancy firm, providing Web solutions to businesses. Perrumal also regularly gives presentations on Java and XML. He has been developing software systems using C++, Delphi and Java for the past 15 years.

Meeraj Moidoo Kunnumpurath works as a senior developer with Mutant Technology Ltd. His key areas of expertise include enterprise application development using J2EE and XML.

Sathya Narayana Panduranga is a Software Design Engineer living in Bangalore, the silicon valley of India. His areas of interest and experience include Distributed and Component based Application Architectures, Object Oriented Analysis and Design, Voice over IP and Convergence platforms. Sathya frequently write articles for Codeguru, a web site for developers.

John Timney is a Postgraduate of Nottingham University having gained an MA in Information Technology following a BA Honours Degree from Humberside University. John specialises in Internet Solutions and his computing expertise has gained him a Microsoft MVP (Most Valuable Professional) award.

Customer Reviews

Average Review:

Post to your social network

     

Most Helpful Customer Reviews

See all customer reviews

Beginning JSP Web Development 5 out of 5 based on 0 ratings. 1 reviews.
Guest More than 1 year ago
This book is great. We had to use it at college as part of our JSP class. It starts you off at the very first level, teaching you what tools you need to get JSP up and running right off the bat. Excellent book.