外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx
- 文档编号:21095570
- 上传时间:2023-01-27
- 格式:DOCX
- 页数:8
- 大小:24.34KB
外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx
《外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx(8页珍藏版)》请在冰豆网上搜索。
Tosearchandtobookhotelrooms.Tonotifyofeveryeventrelatedtoauserbysendingtheemailonagivenaddressduringtheregistrationprocess.
Tosupportdefinitionprocessofeachcomponentofthehotel.Thecomponentsofthehotelare:
rooms,promotions,packages,discountsandservices.Tocompletethereservationprocessbynotifyingthesystemaboutthefactthattheguestcametothehotelandreceivedkeystothebookedroom.
II.JAVASERVERFACES
Theusergraphicalinterfaceisacrucialpartofeverycomputerprogrammewithregardtoitsresponsibilityforinteractionwiththeusers.Thispartofapplicationshouldbeflexible,whichmeanssusceptibletoanyneededchangesandwithoutanydoubts,user–friendly.Regrettably,processofdevelopingsuchuserinterfaceinthemainrequiresusuallyaprofusionofdeveloper'
sworkandtime,makingthewholedevelopmentprocessinvolvedandonerous.ThemostaptingtechnologytothisfieldisJavaServerFaces(JSF).Thisholistic,component-basedsolutionforlongstandingproblemsfacingsoftwaredevelopershasaspecificgoal:
tomakewebdevelopmentfasterandeasierbymaskingalotofcomplexitieshiddenbehindthiskindofprogramming.JSFtechnologyisaserver-sideuserinterfaceframeworkforJavatechnology-basedwebapplications.ThemaincomponentsofJSFtechnologyareasfollows:
TwoJavaServerPagescustomtagslibraryforexpressingUIcomponentswithinaJSPpageandforwiringcomponentstoserver-sideobjects.TheuserinterfacecreatedwithJSFtechnology(representedbymyUIontheFig.1)runsontheserverandrendersbacktotheclient(inthiscasethebrowser).Becauseweb-basedapplications,mustoftenappeasemultipleclients(suchasdesktopbrowsers,cellphones,andPDAs),JSFhasapowerfularchitecturefordisplayingcomponentsindifferentways.Asforthebrowsers,forwhichJSFismostlyused,thedefaultrenderingtechnologyisHTML4.0,thoughtheotherslikeWMLorSVGarealsopossible.OneofthegreatestadvantagesofJSFtechnologyisthatitoffersacleanseparationbetweenbehaviorandpresentationlayers.
III.SPRINGFRAMEWORK
Springisalightweight,inversionofcontrolcontainer,createdtoaddressthecomplexityofenterpriseapplicationdevelopment.SpringmakespossibletouseplainJavaBeanstoachievethingsthatwerepreviouslyonlypossiblewithEJBs[10,11].AnyJavaapplicationcanbenefitfromSpringintermsofsimplicity,test-ability,andloosecoupling.TheSpringFrameworkcontainsalotoffeatures,whicharewell-organizedinsevenmodules.
Whentakenasawhole,thesemodulesgiveeverythingthatisneededtodevelopenterpriseapplications,althoughthereisnomusttobuildtheapplicationfullyontheSpringframework.Onecanpickandchooseonlythosemodulesthatsuitbesttotheapplicationandignoretherest.ThisstrategywaschosenfortheHotelReservationSystemSinceoneofthecorevaluepropositionsoftheframeworkisthatofenablingchoicebynotforcingonetoapplyanyparticulararchitecture,technologyormethodology,Springalsoprovidesconvenientmechanismsforintegrationwithnumberofthird-partyframeworks(alsowithJSFandiBatis).
IV.APACHEIBATISDATAMAPPER
ApacheiBatisJDBC–basedDataMapperprovidessimpleandflexiblewaytotransportdatabetweenrelationaldatabaseandJava,.NetorRubyapplication.ContrarytopopularHibernatelibrary,iBatisdoesnotdirectlytieclassestotablesorfieldstocolumns,butinstead,itcouplesobjectswithresultsofstoredproceduresorSQLstatementsusingsimpleXMLdescriptorlettingthedevelopertoreachonlyforrequireddata.TheiBatisframeworkcanmapnearlyanydatabasetoanyobjectmodelandisverytolerantoflegacydesigns,orevenbaddesigns.SimplicityisthemainadvantageoftheiBatisoverotherframeworks.
TheHotelReservationSystemwasprimarilybuiltuponJSFtechnologyfortheuserinterfacealongwithauxiliarylibraries–SpringandiBatis.TheapplicationarchitectureispresentedinFig.3.Thecompositionofthesystemismodular.Eachlayerisseparatedwithandappropriateinterfacelayer.Suchsolutionmakesthearchitecturenotonlymoreerror-resistantbutalsomoreflexibleforchanges.ThepresentationlayerconsistsofthegraphicaluserinterfacewrittenintheJSFtechnologyandunderlyingbackingbeansobjects.ItcommunicateswiththeServicelayerthroughtheserviceinterfaces.Servicelayeristhecentralbusinesspartofthesystemwhere,onthebasisoftheuserinputdata,properdecisionsaremade.ItalsotranslatesinputdataintoexplicitformunderstoodfortheDataaccesslayer,withwhichcommunicationtakesplacebymeansofDataaccessinterfacelayer.TheDataaccesslayercooperateswithDataMapperlayerandisresponsiblefordataexchangewithdatabase.TheDataMapperlayertalksviaJDBCtodatabasetoaskrequireddata.ThisisalayerwhereiBatisDataMapperplaysthemainrole.
V.JSF-SPRINGINTEGRATION
Inanutshell,JSF–SpringintegrationmakesSpringmanagedbeansvisibleasvariablestoJSF,justasiftheSpringbeansareconfiguredasJSFmanagedbeans.BeforedivingintotheintegrationspecificsofJavaServerFaces,thegeneralintegrationstepforanywebframeworkmustbesetforth.Allthatneedtobedone,istodeclareContextLoaderListenerinthestandardJEEservletweb.xmldeploymentdescriptor.ThislistenerinitializestheSpring'
sWebApplicationContextthatcontainsallofthebusinessbeansintheapplication.(Fig.4).ThesecondstepintheintegrationbetweenSpringandJSFisspecificjustforJSF.ThekeyclassusedinthisprocessisDelegatingVariableResolver.Toconfigurethisvariablethefaces-context.xmlfilemustbeedited.Afteropening<
faces-config>
tag<
application>
tagmustbeaddedandwithinitthe<
variable-resolver>
pointingtotheSpring'
sDelegatingVariableResolvermustbeput.Theexamplefaces-config.xmlfileispresentedin.TheDelegatingVariableResolverdelegatesvaluelookupstothedefaultresolveroftheunderlyingJSFimplementation,andthentoSpring'
sbusinesscontextWebApplicationContext.Thisallowstoeasilyinjectdependenciesintoone'
sJSF-managedbeans.
Exampleoffaces-config.xmlfilefromHotelRVI.JSFANDGETMETHOD.TheJSFonlyrecommendedmethodforsendinginputdatafromanonlineformtoanapplicationserveristhePOSTmethod,thoughsometimesthereisastrongneedforusetheGETmethodinstead.IntheHotelReservationSystemtheGETmethodisusedduringtheregistrationprocessforbringingaboutuseraccountactivation.ThecommonwaytoimplementtheGETmethodistocreateaspecialfilterwhichcanmanipulatetheheaderorcontents(orboth)ofarequestorresponse.ToputGETmethodintooperation,incaseofJavaServerFaces,thefollowingalgorithmmustbefulfilledinthebodyofthefilter:
1.Getparametersfromtherequest.
2.Createappropriatebackingbeanobjectaccordinglytothe
viewthatwillbeusedfurther.
3.Storethebackingbeanobjectinthecurrentsession.
4.SetchangedJSFcontextascurrent.
5.CreateviewandstoreitintheJSFcontext.
6.Executebackingbeansmethods.
TheHotelReservationSystemwasalsobasedontheSpringlibrary,hencesomechangestotherawalgorithmwerenecessary.TheforemostmethodforanyfilterisdoFilter()wheretheproperfiltrationhappens.
publicvoiddoFilter(ServletRequestrequest,
ServletResponseresponse,
FilterChainchain)throwsIOException,
ServletException{
FacesContextfacesContext=
getFacesContext(request,response);
if(facesContext!
=null){
request.getRequestDispatcher(
facesContext.getViewRoot().getViewId()).
forward(request,response);
}else{
chain.doFilter(request,response);
}
ThedoFiltermethodfromGETfilterimplementationAsitmaybeseenonFig.6,anadditionalfunctionimplementingthepresentedalgorithmwasusedtokeepthesourcecodeclearandeasy-to-read.Createappropriatebackingbeanobject.AlmostallbackingbeansfromHotelReservationSystemhaveatleastonepropertyofSpringmanaged-beanorigin.Becauseofthat,itisnecessarytosetthispropertyafterbackingbeanobjectcreation.
WebApplicationContextwac=WebApplicationContextUtils.
getRequiredWebApplicationContext
(servletContext);
RegisterServiceregisterService=
(RegisterService)
wac.getBean("
registerService"
);
ConfirmBeanconfirmBean=newConfirmBean();
confirmBean.
setRegisterService(registerService);
Creatingbackingbeanobjectandsettingspring–originproperty.GettingSpringmanaged-beanobjectrequiresoperatingonSpring'
sWebApplicationContextobjectthatisinitialisedduringtheserverstart-up.SetchangedJSFescontextascurrent.WhenstoringbackingbeanobjectinthesessionthewholeFacescontextbecomeschanged,thereforeitmustbesetascurrentinorderallmodificationstakeplace.
FacesContextFactorycontextFactory=(FacesContextFactory)
FactoryFinder.getFactory(
FactoryFinder.FACES_CONTEXT_FACTORY);
LifecycleFactorylifecycleFactory=(LifecycleFactory)FactoryFinder.
getFactory(FactoryFinder.
LIFECYCLE_FACTORY);
Lifecyclelifecycle=lifecycleFactory.
getLifecycle(LifecycleFactory.
DEFAULT_LIFECYCL
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 外文翻译基于JavaServer Faces技术的酒店预订系统 外文 翻译 基于 JavaServer Faces 技术 酒店 预订 系统