Java Reference
In-Depth Information
Chapter 10
JavaBeans
Learning Objective s
After reading this chapter, you should:
￿ understand the rationale behind JavaBeans;
￿ appreciate the potential offered by JavaBeans;
￿ know how to create a JavaBean and how to expose selected properties of the
bean;
￿ know how to use a JAR fi le to package a JavaBean and its associated fi les;
￿ know how to cause changes in one bean's properties to have automatic effects on
other beans;
￿ know how to make use of beans in an application program;
￿ know how to make use of beans in JSPs, both via direct invocation of bean
methods and via HTML tags.
For a number of years, one of the primary goals of software engineering has been to
create and make use of general-purpose software components that may be 'plugged' into
a variety of applications. The internal workings of such components are hidden from the
application developer and are of no concern to him/her. The only things that the devel-
oper needs to know are what purpose the component serves and what interface it pro-
vides (i.e., what parameters need to be passed to the component and what value(s) the
component will return). The major advantages of such components are fairly obvious:
￿ greatly reduced time and expense for software development, as developers reuse
software and avoid 'reinventing the wheel';
￿ much more reliable software (since the reused components will generally have
been used in many other applications and will be 'tried and tested').
One of the most well known and widely used component models is Microsoft's
ActiveX. Powerful though its capabilities are, it has one major drawback: it is depen-
dent upon the MS Windows platform (though moves have been made to alleviate
this situation). Java provides a platform-independent alternative to this with its
JavaBeans component model.
Search WWH ::




Custom Search