What Is a JavaBean?

This section describes what is a JavaBean - a reusable software component written in Java. A JavaBean is a really Java class that conforms with some special rules: serializable, with a constructor of no argument, and supporting properties using getter/setter methods; NoClassDefFoundError Exception

What Is a JavaBean? A JavaBean is a reusable software component written in Java. A JavaBean is a really Java class that conforms with following special rules:

Here is my first JavaBean class that meets the above requirements:

/**
 * CoffeeBean.java
 * Copyright (c) 2012, HerongYang.com, All Rights Reserved.
 */
package herong;
import java.io.*;
public class CoffeeBean implements Serializable {
   private String name;
   private boolean decaf;
   public CoffeeBean() {
      name = "French Roast";
      decaf = false;
   }
   public String getName() {
      return this.name;
   }
   public void setName(final String name) {
      this.name = name;
   }
   public boolean isDecaf() {
      return this.decaf;
   }
   public void setDecaf(final boolean decaf) {
      this.decaf = decaf;
   }
}

Last update: 2012.

Table of Contents

 About This Book

 JSP (JavaServer Pages) Overview

 Tomcat 7 Installation on Windows Systems

 JSP Scripting Elements

 Java Servlet Introduction

 JSP Implicit Objects

 Syntax of JSP Pages and JSP Documents

 JSP Application Session

 Managing Cookies in JSP Pages

JavaBean Objects and "useBean" Action Elements

What Is a JavaBean?

 "jsp:useBean" Action Elements

 Servlet Class Converted from UseBean.jspx

 Setting and Getting JavaBean's Properties

 Using JavaBean Objects in Scripting Elements

 Using Java Objects as JavaBeans

 getProperty() Error on Tomcat 7

 Refreshing Loaded JavaBean Classes

 Importing Unnamed Package Class Error

 Using JavaBean without Import Element Error

 Creating JavaBean Classes in Named Packages

 "NoClassDefFoundError" Exception

 Managing HTTP Response Header Lines

 Non-ASCII Characters Support in JSP Pages

 Performance of JSP Pages

 EL (Expression Language)

 Overview of JSTL (JSP Standard Tag Libraries)

 JSTL Core Library

 JSP Custom Tags

 JSP Java Tag Interface

 Custom Tag Attributes

 Multiple Tags Working Together

 File Upload Test Application

 Outdated Tutorials

 References

 PDF Printing Version