Hi guys,
I am trying to understand the use of beans in the context of
servlets. Firstly I'm going to write down my definition of a bean and f someone could correct my interpretation of it then that would be really great:
I think the implementation of a bean is really simple. It is just a typical class that is used for storing related information. In theat regard its methods are simply of the for setXXX() and getXXX();
Thats its only function. Is that correct? Can a
java bean have any other sorts of methods or does that exclude it from being a bean? Should logic be carried out icside the bean, or again, does that invalidate it?
The other thing is a bean in the context of a servlet. I've been told that
you should encapsulate any related information in a javabean. Then youcan pass it around methods and even servlets if you want to use sessions. Am I right in thinking that this is what a javabean is for - passing round information in a nicely packaged way.
Am I also right in thinking that as long as pass the java bean around via method parameters and dont assign the bean globally, that the java bean data wont become corrupt because only the correct request will ever be accessing the information?
Thanks guys and take care
Regards
Simon Harvey