外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx

上传人:b****6 文档编号:21095570 上传时间:2023-01-27 格式:DOCX 页数:8 大小:24.34KB
下载 相关 举报
外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx_第1页
第1页 / 共8页
外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx_第2页
第2页 / 共8页
外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx_第3页
第3页 / 共8页
外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx_第4页
第4页 / 共8页
外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx_第5页
第5页 / 共8页
点击查看更多>>
下载资源
资源描述

外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx

《外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx(8页珍藏版)》请在冰豆网上搜索。

外文翻译基于JavaServer Faces技术的酒店预订系统Word文档下载推荐.docx

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

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 外语学习 > 英语考试

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1