Home arrow Java arrow Page 7 - 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 - The Java Community
(Page 7 of 7 )

In fact, the multiplicity of servlet containers is another example of the biggest strength of the Java family of technology: choice. All the Java technologies are controlled by a community of developers and corporations who together form the Java Community Process (JCP). The JCP system enables anyone to contribute to the future of Java by participating in expert committees that shape new features of the language or simply by issuing feedback to Java’s architects.

Through the JCP and the documents it publishes into the public domain, anybody can develop Java extensions and features as defined by the JCP. The JCP’s main purpose is to prevent the Java language from degenerating into a chaos of incompatible, duplicated, and redundant functionality by setting standards. However, because of the freedom to create Java technology based on these standards, Java developers have a great deal of choice of development tools offered by a variety of competing vendors.

This philosophy is often referred to as “agree on standards, compete on implementation.” It’s in direct contradiction to Microsoft’s philosophy embodied in such technologies as its .NET platform. Microsoft controls the standards used in .NET, and it creates most of the development tools associated with .NET. Considering the benefits and pitfalls of each model—Java’s community-driven approach versus Microsoft’s benevolent dictatorship approach—is a complex and often emotionally charged issue that we’ll leave out of this book.

Web Applications

To create a Web application of any significant utility, a developer usually creates many different JSP pages and/or servlets. Additionally, the developer may have a number of images and HTML pages they want to associate with the JSP pages and servlets, and there may be code libraries and other files that form part of the same application.

Keeping track of all of these files can be a bit difficult, and configuring a servlet container to know where to find them all can seem quite a nightmare. Hang on—actually, it’s really rather easy. It turns out that there’s a standard directory layout for Web applications. Furthermore, a standard configuration file for Web applications tells servlet containers how the Web application works. Both of these are regulated by the JCP as described previously.

By following this standard layout, Java developers don’t have to worry about how to configure different servlet containers; it all happens automatically. Chapter 2 discusses this standard directory layout in greater detail.

Application Servers

Servlet containers are only part of the Java story. Since the development of servlet and JSP technology, many additional Java technologies have been created that ease the development of large and complex business applications, either for use on the Internet or for use on private intranets. Examples of these technologies include Enterprise JavaBeans, which aims to make it easier for developers to distribute Java code onto many different servers (as opposed to having all of the code for an application on one server), and the Java Connector Architecture, which helps developers include older, pre-Java applications and data sources in their applications. These advanced technologies geared toward large businesses make up the J2EE standard, which was briefly mentioned at the start of this chapter.

A servlet container alone isn’t sufficient to power J2EE applications. Instead, an application server is required. This supports all of the J2EE technologies, is usually much more feature-rich than a servlet container such as Tomcat, and often includes features that enable it to service many more users than a typical servlet container. However, because JSP and servlets compose a key part of the J2EE platform, application servers also must support the same features that a servlet container does—and often, an application server simply integrates with one of the existing servlet containers.

Although application servers can set you back tens of thousands of dollars, some free application servers are available, such as jBoss (http://www.jboss.org).


In closing, we’ll talk about JavaScript. JavaScript is a technology that enables Web pages to have some programmatic functionality in the browser. Java applets are isolated applications that are simply displayed on a Web page, but JavaScript works with and can manipulate the HTML page in which it’s embedded.

Some folks, after coding some JavaScript code here and there, are under the impression they know Java and have programmed in Java, but this isn’t really true. JavaScript isn’t Java; it’s an entirely distinct programming language that was developed about the same time Java was released.

Originally called LiveScript, the name was changed by Netscape to JavaScript because its syntax was similar to Java’s and because those behind it wanted to capitalize on the exposure and popularity of the Java language. However, Microsoft introduced its own scripting language, JScript, and after a while a neutral standard was developed, with the decidedly less appealing name of ECMAScript. Today, JavaScript and JScript are based on this open standard (also called ECMA-262), but Netscape and Microsoft persist in using their proprietary names for their implementations.

To better understand the distinction between JavaScript and JSP, it may help you to remember that JavaScript code is generally executed by the Web client (browser) after the Web server sends the browser the HTTP response, and JSP code is executed by the Web server before the Web server sends the HTTP response. In fact, JSP is what creates the HTTP response. Thus, JavaScript is said to be a client-side technology, and it’s code that can be viewed (and copied) by Web users; JSP is a server-side technology where the code isn’t visible to Web users because it’s processed by the Web server before reaching the client.


In this chapter, we’ve tried to get you up and running as a budding Web developer. You’ve done the following:

  • Installed the basic tools you need to create Java Web applications

  • Created your first simple Web application

  • Examined the history of the Web, the difference between static and dynamic Web content, the approaches to creating dynamic content, and the difference between client-side programming (such as JavaScript) and server-side programming (such as JSP or servlets)

In subsequent chapters, you’ll build on this foundation to create increasingly complex and useful Web applications, and you’ll also learn more details about how the Java language works.

DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

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