14.8. JavaBeans

A JavaBean is a regular Java class that has its member variables (its properties) available to set methods, which update their values, and get methods, which retrieve their values. They are simple, easy-to-write repositories for information that must define a method to get and another method to set each of their elements.

JavaBeans are actually carried over from Swing, where they have a rather different meaning. In the Swing world, JavaBeans create reusable components, often for making Java IDEs. There are several truths (or at least conventions) that your JavaBeans for JSP must uphold:

  • The Java class that defines your bean should be named ClassNameBean. That is, your descriptive name should be appended with “Bean.” So, a bean ...

Get Java™ for ColdFusion® Developers 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.