Q

What is a Java Bean? Why it is useful in J2EE?

What is a Java Bean? Why it is useful in J2EE?

A Java Bean is a software component written in the Java programming language that conforms to the JavaBeans component specification. The JavaBeans APIs became part of the "core" Java APIs as of the 1.1 release of the JDK.  

The JavaBeans specification defines a Java-based software component model that adds a number of features to the Java programming language. Some of these features include:

* introspection 

* customization 

* events 

* properties 

* persistence  

Java Beans are used throughout J2EE 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. J2EE's JavaBeans Activation Framework uses Java Beans for integrating support for MIME data types into J2EE. The J2EE Management API uses JavaBeans as the foundation for the instrumentation of resources to be managed in a J2EE environment.

This was last published in January 2003

Dig Deeper on Java Web Services

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

From what I can make out, a JavaBean is basically a class just like any other java class except that it adheres to certain conventions, i.e.:

The class must implement Serializeable
Class properties are assumed to be private and their names start with a lowercase letter
Each property must have it's respective getter and setter methods.
Each setter method starts with the prefix 'get' followed by the property name e.g. setName()
Setter methods are public and void
Same applies to the getter methods (prefix 'get', public, return type respective property class type etc.)
For boolean properties instead of 'get' one uses the prefix 'is'
Strictly speaking it is the instance of the class that is considered a 'bean' not the class itself.

Regards,
http://snehal.techproceed.com
Cancel

-ADS BY GOOGLE

SearchSoftwareQuality

SearchCloudApplications

SearchAWS

TheServerSide

SearchWinDevelopment

Close