Chapter 10. Writing Beans

Chapter 9 provided a bridge between the world of JSPs and the world of Java. We can now cross that bridge to explore those most important of Java classes: beans! This chapter describes beans from a programmer’s perspective and shows how to create beans and make their properties available to JSPs.

How Beans Are Implemented

Internally, a bean is an instance of a Java class, although in common terminology, the class itself may also be referred to as a bean. The most basic kind of bean exposes a number of properties by following a few simple rules regarding method names. In general, a bean provides two methods for each property: a method to get the property and one to set the property, corresponding directly to the jsp:getProperty ...

Get JavaServer Pages™, Second Edition 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.