Java - Beans


What is a Java Bean?

A Java Bean is a Java object that satisfies certain requirements:

  1. The JavaBean class must implement either Serializable or Externalizable
  2. The JavaBean class must have a no-arg constructor
  3. All JavaBean properties must have public setter and getter methods
  4. All JavaBean instance variables should be private

Java Beans are used throughout Java EE as a universal contract for runtime discovery and access. For example, JavaServer Pages (JSP) uses Java Beans as data transfer objects between pages or between servlets and JSPs. Java EE's JavaBeans Activation Framework uses Java Beans for integrating support for MIME data types into Java EE. The Java EE Management API uses JavaBeans as the foundation for the instrumentation of resources to be managed in a Java EE environment.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License