&KDSWHU
WKHUH DUH QR
XPE 4XHVWLRQV
Q:
7HATSTHEDIFFERENCE
BETWEEN%*"AND*%%
A:
"OTH*%%AND%*"ARE
SPECIFICATIONSFORASERVER"UT%*"
ISACTUALLYASUBSETOF*%%)NOTHER
WORDSA*%%SERVERMUSTINCLUDE
AN%*"CONTAINER7EVEUSEDTHE
WORDSERVERONTHESEFIRSTPAGESBUT
TECHNICALLYTHETHINGTHATENTERPRISE
JAVABEANSRUNINISCALLEDAN%*"
CONTAINER3OEVERY*%%SERVERMUST
INCLUDEAN%*"CONTAINERALONG
WITHA7EBCONTAINERTHATCANRUN
SERVLETSAND*30S
4HISEXAMISABOUTTHE%*"PORTION
OF*%%WHEREASTHE3#7#$EXAM
3UN#ERTIFIED7EB#OMPONENT
$EVELOPERISABOUTTHE7EBPORTION
OF*%%
,ATERINTHISCHAPTERWELLGETMORE
INTOTHEDETAILSOFHOW*%%AND%*"
FITTOGETHER
&ORTHERESTOFTHISBOOKWEUSE
THETERMS%*"SERVERCONTAINER
ANDSERVERINTERCHANGEABLY)FTHE
DIFFERENCEBETWEENTHETERMS
MATTERSWELLMAKEITCLEAR
Q:
#AN)USE%*"COMPONENTS
WITHOUTAN%*"COMPLIANTAPP
SERVER
A:
.OPE%*"COMPONENTSCANT
LIVEOUTSIDEOFAN%*"CONTAINER4HEY
DONTHAVEAMAINMETHODANDEVEN
IFYOUADDONETOYOURBEANCLASS
THEBEANWOULDNTBEVERYUSEFUL
ONITSOWN-OSTOFTHEMETHODSIN
ANENTERPRISEBEANARECALLEDBYTHE
CONTAINERITSELFANDHAVENOMEANING
OUTSIDETHESERVER2EMEMBERTHE
WHOLEPOINTOFAN%*"SERVERISTO
GIVEYOUALLTHEBIGSERVICESSECURITY
TRANSACTIONSETCANDWITHOUTTHE
SERVERYOUDLOSEEVERYTHINGBUT
YOURBASICBUSINESSLOGIC!NDIFTHAT
BUSINESSLOGICRELIESONTHECONTAINER
FOREXAMPLECALLINGMETHODS
ONINTERFACESPROVIDEDBYTHE
CONTAINERTHENEVENTHEBUSINESS
LOGICWOULDFAIL
Q:
#AN)DESIGNANDWRITEMY
CODEINSUCHAWAYTHATMOSTOF
THEBUSINESSLOGICISINAPLAINOLD
*AVACLASSANDJUSTHAVETHEBEAN
CALLMETHODSONTHATCLASS4HAT
WAY)COULDSTILLREUSETHEBUSINESS
LOGIC
A:
9ESYOUCANDOTHATANDIN
FACTALOTOFDESIGNERSWRITESEPARATE
NONBEANREUSABLECLASSESANDTHEN
HAVETHEBEANSINVOKEMETHODS
ONTHOSECLASSES)FYOURBEANCALLS
AMETHODONANONBEAN*AVA
CLASSTHATMETHODISSTILLUNDERTHE
CONTROLOFTHECONTAINERSOASFAR
ASTHECONTAINERISCONCERNEDTHAT
NONBEANMETHODISJUSTPARTOFTHE
BEANSFUNCTIONALITY
Q:
7HATSTHEDIFFERENCE
BETWEENREGULARJAVABEANSAND
ENTERPRISE
JAVABEANS
A:
#ONGRATULATIONS9OURETHE
MILLIONTHPERSONTOHAVEASKEDTHAT
QUESTION
4HETERMhJAVABEANvMEANSA
REUSABLECOMPONENT2EGULAROLD
NONENTERPRISEBEANSANDBEANSIS
JUSTASHORTERFORMOFJAVABEANSARE
REUSABLECOMPONENTSTHATFOLLOWA
NAMINGCONVENTIONTHATCANBEUSED
BYDEVELOPMENTTOOLS
"YFARTHEMOSTCOMMONTYPEOF
JAVABEANISANY'5)COMPONENTLIKE
A3WINGBUTTONORTEXTFIELD.EARLY
ALL*AVA)$%SAREJAVABEANCOMPLIANT
SOTHATIFYOUREWORKINGINAVISUAL
LAYOUTTOOLYOUCANCLICKONABUTTON
ANDUPPOPSAPROPERTYSHEETWHERE
YOUCANSETTHECOLORSIZEFONTETC
4HETOOLKNOWSWHICHPROPERTIESTHE
BEANHASBECAUSETHEBEANFOLLOWS
CONVENTIONSFORGETTERSANDSETTERS
"UTREGULARJAVABEANSARENTJUST
FOR'5)COMPONENTSOTHER*AVA
TECHNOLOGIESINCLUDING*INIAND
3ERVLETSCANUSEJAVABEANFEATURES
%NTERPRISEJAVABEANSAREALSO
REUSABLECOMPONENTSBUTTHATS
WHERETHESIMILARITYENDS4HE@BEAN
PARTOFAREGULARJAVABEANISUSED
MOSTLYATDEVELOPMENTTIMEASA
WAYTOEASEORSPEEDUPHOOKING
ONEBEANSEVENTSTOANOTHERBEANS
METHODSORSETTINGPROPERTYVALUES
WHICHOFTENMEANTHESAMETHING
ASINSTANCEVARIABLEVALUES!REGULAR
BEANRUNSINA*6-JUSTLIKEANY
OTHERNORMAL*AVACLASS"UTTHE
hBEANvPARTOFANENTERPRISEBEAN
KICKSINATRUNTIMEANDANENTERPRISE
BEANMUSTBERUNUNDERTHECONTROL
OFAN%*"CONTAINER
&ORTHERESTOFTHEBOOKWHENWE
SAYBEANWEMEANENTERPRISEBEAN
(-%
TXHVWLRQV