Chapter 3. JavaBeans and JSP Concepts
Before we can start learning about how you can use JavaBeans in JavaServer Pages, we must take a look at what a bean is. A JavaBean is a 100% Java component that works on any Java Virtual Machine. The minimum requirements that make a component a JavaBean are as follows:
It must support the JDK 1.1 and later Serialization model.
It must use get/set accessors to expose its properties.
There is nothing magical about creating a JavaBean. You just create a Java class that implements the java.io. Serializable interface and uses public get/set methods to expose its properties. Listing 3.1 contains a simple JavaBean.
Code Listing 3.1. SimpleJavaBean.java
import java.io.Serializable; public class SimpleJavaBean implements ... |
Get Pure Java Server Pages™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.