The NetBeans E-commerce Tutorial - Introduction
Welcome to the NetBeans E-commerce Tutorial. In this multi-part tutorial, you learn how to create a simple yet effective e-commerce application that demonstrates various important features of Java web and EE development. In doing so, you'll familiarize yourself with the NetBeans IDE and become capable of applying it to your own development purposes.
Taking the time to master the IDE will ultimately lead you to become more efficient and versatile as a developer. While you work through the tutorial units, you'll learn how to make best use of the IDE's facilities and tools. These include:
The tutorial is modular in fashion, with each unit focusing on specific concepts, technologies, and features of the IDE. You can successfully follow a tutorial unit on its own using the provided setup instructions and application snapshots (from Unit 5 onward). However, you'll get the most benefit by working through all units consecutively, from beginning to end. This will also help to illustrate the development process.
Unit 3, Setting up the Development Environment introduces you to the NetBeans IDE. In it, you create a Java web project which is the basis for the work you undertake in later tutorial units. In Unit 4, Designing the Data Model, you primarily work with MySQL WorkBench, a visual database design tool, to create a data model for the application. Each successive tutorial unit provides you with a project snapshot that corresponds to the project's beginning state for that given unit. This enables you to work through a single tutorial unit outside of the E-commerce Tutorial's larger context. To use these snapshots, download them to your computer and open them in the IDE using the Open Project wizard (Ctrl-Shift-O; ⌘-Shift-O on Mac).
You can view a live demo of the application that you build in this tutorial: NetBeans E-commerce Tutorial Demo Application.
The remainder of this unit covers some information relevant to the tutorial, as well as basic concepts necessary for Java EE development. Make sure you understand the concepts outlined below before proceeding with development.
About this Tutorial
Who this Tutorial is for
The content of this tutorial caters to four demographics:
If you fall into any of these categories, this tutorial will be helpful to you. Depending on your background, you may find that certain tutorial units are more difficult to grasp than others. Understanding how technologies work is key to leveraging the IDE for your purposes. Therefore, if you are really interested in learning the technologies involved, you may find that this tutorial works best as a companion to the Java EE Tutorial. For each tutorial unit, make best use of the provided links to relevant areas in the Java EE Tutorial, as well as to other useful resources.
What this Tutorial Covers
The application that you develop in this tutorial involves numerous concepts, technologies, and tooling components:
What is an E-commerce Application?
The term e-commerce, as we think of it today, refers to the buying and selling of goods or services over the Internet. For example, you may think of Amazon, which provides online shopping for various product categories, such as books, music, and electronics. This form of e-commerce is known as electronic retailing, or e-tailing, and usually involves the transportation of physical items. It is also referred to as business-to-customer, or B2C. Other well-known forms include:
This tutorial focuses on business-to-customer (B2C) e-commerce, and applies the typical scenario of a small retail store seeking to create a website enabling customers to shop online. Software that accommodates a B2C scenario generally consists of two components:
What is Java?
In the computer software industry, the term "Java" refers to the Java Platform as well as the Java Programming Language.
Duke, the Java mascot
Java as a Programming Language
If you'd like to learn more about the Java language, see the Java Tutorials.
Java as a Platform
The Java Platform signifies a software-based platform that is comprised of two parts:
You can see a visual representation of the Java platform by viewing the
conceptual diagram of component technologies provided in the
As shown below, the diagram is interactive, enabling you click on components
to learn more about individual technologies.
As the diagram indicates, the JDK includes the Java Runtime Environment (JRE). You require the JRE to run software, and you require the JDK to develop software. Both can be acquired from Java SE Downloads.
The Java Platform, Enterprise Edition (Java EE) builds upon the Java SE platform and provides a set of technologies for developing and running portable, robust, scalable, reliable and secure server-side applications.
EE technologies are loosely divided into two categories:
Depending on your needs, you may want to use certain technologies from either category. For example, this tutorial makes use of Servlet, JSP/EL, and JSTL "web" technologies, as well as EJB and JPA "enterprise" technologies.
Java EE currently dominates the market, especially in the financial sector. The following diagram is taken from an independent survey for European markets performed in 2007.
For a recent, informal comparison of Java EE to .NET, see the blog post Java EE or .NET - An Almost Unbiased Opinion by a well-known member of the Java EE community.
What's the Difference Between...?
There are many abbreviations and acronyms to parse. If you're new to all of this and find the above explanation somewhat confusing, the following resources can help explain what the differences are between some of the commonly used terminology.
What is the Java Community Process?
The Java Community Process (JCP) is a program that manages the development of standard technical specifications for Java technology. The JCP catalogs Java Specification Requests (JSRs), which are formal proposals that document the technologies which are to be added to the Java platform. JSRs are run by an Expert Group, which typically comprises representatives of companies that are stakeholders in the industry. The JCP enables Java technology to grow and adapt according to the needs and trends of the community.
The JSRs of technologies used and referred to in this tutorial include the following:
You can use the JCP website to search for individual JSRs. You can also view all current EE technologies (Java EE 6) at:
Java EE 5 technologies are listed at:
A JSR's final release provides a reference implementation, which is a free implementation of the technology. In this tutorial, you utilize these implementations to develop the sample e-commerce application. For example, the GlassFish v3 application server, which is included in the standard Java download bundle for NetBeans 6.8, is the reference implementation of the Java EE 6 platform specification (JSR 316). As a reference implementation for the Java EE platform, it includes reference implementations for the technologies included in the platform, such as Servlet, EJB and JPA technologies.
Why use an IDE?
Firstly, the term IDE stands for integrated development environment. The purpose of an IDE has traditionally been to maximize a developer's productivity by providing tools and support such as:
Consider what would be necessary if you wanted to create a Java-based web application manually. After installing the Java Development Kit (JDK), you would need to set up your development environment by performing the following steps.
For educative purposes, it is worthwhile to create and run a Java web project manually so that you are aware the necessary steps involved. But eventually, you'll want to consider using tools that reduce or eliminate the need to perform tedious or repetitious tasks, thereby enabling you to focus on developing code that solves specific business needs. An IDE streamlines the process outlined above. As demonstrated in Unit 3, Setting up the Development Environment, you'll install NetBeans IDE with the GlassFish application server, and be able to set up a web application project with a conventional directory structure using a simple 3-step wizard. Furthermore, the IDE provides provides built-in API documentation which you can either call up as you code in the editor, or maintain open in an external window.
An IDE also typically handles project compilation and deployment in a way that is transparent to you as a developer. For example, the web project that you create in NetBeans includes an Ant build script that is used to compile, clean, package and deploy the project. This means that you can run your project from the IDE, and it will automatically be compiled and deployed, then open in your default browser. Taking this a step further, many IDEs support a Deploy on on Save feature. In other words, whenever you save changes to your project, the deployed version on your server is automatically updated. You can simply switch to the browser and refresh the page to view changes.
IDEs also provide templates for various file types, and often enable you to add them to your project by suggesting common locations and including default configuration information where necessary.
Aside from the "basic support" described above, IDEs typically provide interfaces to external tools and services (e.g., application and database servers, web services, debugging and profiling facilities, and collaboration tools) which are indispensable to your work if Java development is your profession.
Finally, IDEs usually provide enhanced editor support. The editor is where you likely spend most of your time working, and IDE editors typically include syntax highlighting, refactoring capabilites, keyboard shortcuts, code completion, hints and error messages, all aiming to help you work more efficiently and intelligently.
Why use NetBeans?
People are saying great things about NetBeans. For a list of testimonials, see NetBeans IDE Testimonials. Many developers are migrating their applications to NetBeans from other IDEs. For reasons why, read Real Stories From People Switching to NetBeans IDE.
The IDE provides many features for web development, and several advantages over other IDEs. Here are several noteworthy points:
For a more extensive list of reasons why you should consider choosing NetBeans, see NetBeans IDE Connects Developers.