网上商城系统毕业设计外文翻译管理资料.docx
《网上商城系统毕业设计外文翻译管理资料.docx》由会员分享,可在线阅读,更多相关《网上商城系统毕业设计外文翻译管理资料.docx(9页珍藏版)》请在冰点文库上搜索。
网上商城系统毕业设计外文翻译管理资料
毕业设计说明书
英文文献及中文翻译
班级:
学号:
姓名:
学院:
专业:
指导教师:
1StrutsFrameworkBasedonMVC
InthetraditionalWebapplication,JavaServerPages(JSP)pagesareresponsibleforhandlingallthings,forexample,receivingrequests,executingbusinesslogics,choosingthenextpage.ThesecomplicatedthingsmayleadtochaosofJSPpages’codesandbeharmfulfortheextensionandmaintenanceofpages.TheModel-View-Controller(MVC)modeseparatestheprogrammingcodesintothreedifferentareas,whichhassolvedtheaboveproblem.MVCcanrealizeJ2EEapplicationsystem'sstratificationandtheloosecouplingofthreelayersormultilayer,anditisarealizationwayoforientingdynamiccontent.TheMVCmodedividesapplicationintothreecorecomponentsofModel,ViewandController.
StrutsisarealizationofMVC.ItisanopensourceWebapplicationframeworkandusesServletandJSPmarksthatbelongtotheJ2EEnormasapartoftherealization.StrutsinheritsMVCcharacteristicsandrealizessomecorrespondingchangesandextensionaccordingtoJ2EEtraits.StrutsseparatesJavacodesofJSPbyJavaBeanandActionclasstobetheMVCmode,transmitsdataamongthethreepartitionsofModel,ViewandController,demonstratestheconnectionbetweenvariousclassesandJSPpagesbyconfigurationfilesfinallyanditintendstorealizetheseparationofpresentationlayer,businesslayeranddatalayer.TheStrutsstructureisshowninFigure1.
TheModelcontainsthebusinesslogicthatexchangesdatawithapersistencelayer.TheViewisinchargeofproducingwhatisdirectlyvisibletotheuser,.webpages.TheControlleristhelayerthatreceivesrequestsfromclients,determineswhatbusinesslogictakesplaceandwheretogonext.IntheStrutsframework,theModelusesJavaclassesforthebusinesslogic.TheViewcanbeimplementedwithJSPandtheTaglibofStruts.TheControllerisaJ2EEcomponentknownasServlet,morespecificallyanActionServletobject,whichdetermineswhatorwhenlogicgetsexecutedandwherethecontrolshouldgetdirected.
2HibernateFrameworkBasedonORM
Workingwithboththeobject-orientedsoftwareandtherelationaldatabaseisacomplicatedtaskwithJavaDatabaseConnectivity(JDBC)becausethereismismatchbetweenhowdataisrepresentedinobjectsversusrelationaldatabase.SowithJDBC,developershavetowritepuretheStructuredQueryLanguag(SQL)statementstomapanobjectmodel'sdatarepresentationtoarelationaldatamodelanditscorrespondingdatabaseschema.
IntroductionofHibernate
HibernateisaflexibleandpowerfulObject-RelationalMapping(ORM)solutiontomapJavaclassestodatabasetables.Itisapowerful,highperformanceobject-relationalpersistenceandqueryservice.HibernateallowsdeveloperstoexpressqueriesinitsownportableSQLextension(HibernateQueryLanguage(HQL))[3],aswellasinnativeSQL,orwithanobject-orientedcriteriaandexampleApplicationProgrammingInterface(API).HibernateitselftakescareofthismappingusingXMLfilessodevelopersdon’tneedtowritecodeforthis.
Hibernateisanopensourceanditisfreetouseforbothdevelopmentandproductiondeployments,whichisabridgebetweenJavaapplicationandrelationaldatabaseandtakeschargeofmappingbetweenJavaobjectsandrelationaldata.TheinsideofHibernatepackstheoperationofaccessingdatabasebyJDBC,whichprovidesAPIofobject-orienteddatabaseaccesstoupperlayerapplication.Sodeveloperscanusetheobjectprogrammingthoughttooperatedatabasesufficiently,caringforthebottomdatabasestructureunnecessarily.
Hibernaterelievesthedeveloperfrom95percentofcommondatapersistencerelatedprogrammingtasks,comparedtomanualcodingwithSQLandtheJDBCAPI[4].AnditcanintegratevariousWebserverorapplicationserver,andnearlysupportallpopulardatabasesserver.
PrincipleofHibernate
Asshowninfigure,Hibernateliesinthemiddlelayerthatisbetweenapplicationanddatabase.Intheprovidedpersistentservice,Hibernatemapsclasstorowsofdatasheetbypropertiesandmappingfilesofclass()itself.ApplicationinteractswithdatabasebyPersitstentObject(PO)tohandledatadirectly.
FigureHibernatesystematicstructure
3TheIntegrationofStrutsandHibernate
Intheopensourceframeworks,forthepresentationpart,Tapestryhasthepowerfulandnaturalcombinationofpages,itsdocumentistooconceptionaltobenefitprogramming.Anditslearningcurvewastoosteepandsoon.Forthelogicpart,Springhasagoodintegrationfunction,butthereisalackofpubliccontroller.AndEJBdependsontheEJBcontainers,atthesametime,itisrealizedcomplicatedly.WhileStrutshasbeenappliedextensivelybecauseofitsadvantages.
Atpresent,mostofsystemsapplytherelationaldatabasesmainly,whileJavaisanobject-orientedlanguageessentially.InModelpartofStrutsframeworkapplication,usingSQLandJDBCtooperatedatabaseswhenstoringandfetchingobjectsreducesprogrammingefficiencyandthesystematicmaintainability.TraditionalJ2EE-basedapplicationappliesheavyweightframeworkbasedonEJBthatadaptstothelargeenterprisedevelopment,whiledevelopmentanddebuggingbyEJBcontainerneedtoconsumeaplentyoftimeandhighprice.EJB3improvesthedisadvantagesoforiginalEJB,butitsapplicationisnotmatureyet.
HibernatecansubstituteContainer-ManagedPersistence(CMP)toaccomplishheavyresponsibilityofpermanenceinJ2EEframeworkofapplyingaword,HibernatecanresolvethedifficultiescomingfromusingtraditionalCMP,JDBCandDataAccessObject(DAO)inatechnologicaldevelopment.Forreducingthecouplingofcodeandraisingsystematicdevelopmentefficiency,thispapersuggestsJ2EEapplicationdevelopmenttacticsbasedonStrutsandHibernate.
TheStrutsdesignshowstheMVCframeworksufficiently,whichallcontrolflowsneedaconfigurationfile()tomanage,andwhichisconvenienttomaintain.TheintegrationofStrutsandHibernateisthatHibernatesolvesthemodellayerofStruts,whichmakesdevelopersoperateJavaobjectsinsteadofdatabase.Theintegrationshowstheobject-orientedthoughtsufficientlyandsolvessomeproblemsofthedatabaseoperationintraditionalJ2EEwell.
FlowofFramework
TheflowofintegrationframeworkbasedonStrutsandHibernateisshowninFigure3.Atfirst,userssendHttprequestsbyBrowser,thenHttprequestsareacceptedbyActionServletofthecontrolcomponentinbusinesslayer,thengavetoRequestProcessorwhichgetscorrespondingActionfromActionMappingbyrequestURL[3].Besides,ActionFormpacksJSPpages,whichcanmakeacheckingtodataofdatasheetifitisneeded,sendbackActionErrorstovisualpagesiftherearemistakesandtransferthedataofpagestoActionifitpassesvalidation.
RequestProcessortransfersthe“execute”methodofActionandthemethodtransfersthebusinesslogicmodule.HibernateaccomplishesinteractionofdatabasesandJavaBean.Theoperationofprocessingbusinesslogicinteractswithdatabasebydatapermanencelayerandfieldobjectlayer.The“execute”methodofActionwillreturnActionForwardobjectsthatareacceptedbyActionServletafterexecuting.
SystematicStructureoftheIntegrationFramework
TheEISlayerofthemulti-layerJ2EEsystematicstructurecanbepartitionedintothedatapermanencelayerandthedataresourcelayer.Itmeansasystemcanbedividedintofivelayersasawhole.
ClientLayer:
ThislayerrunsintheBrowserofusers’machinesandhandlesinteractionwithusers,transmitsandshowsmessagestousers.J2EEplatformsupportsdifferenttypeusersincludingHTMLusers,JavaApplets,Javaapplication,etc.
PresentationLayer:
ThislayerworksinJ2EEWebcontainer,producesthesystematicrepresentationlogic,handlesusers’requestsandmakestheresponses.TheentireWebisbuiltonStrutsframework,inwhichtheViewcomponentiscomposedofJSP/HTMLpageswhosedataisexpressedbyActionFormBean,theControllercomponentiscomposedofActionServletunitedandActionClasses,andtheModelcomponentisrealizedbybusinesslogicLogicLayer:
Thislayeraccomplishestherequiredbusinessofsystem,providestherequiredbusinessmethodtopresentationlayer.Itcanreceivedatafromclientprogramsandsavethemtothestorageequipmentafterproperdisposal,readdatafromthedatastorageequipment,thensendthemouttoclientprograms.
1基于MVC的Struts框架
在传统的Web应用程序,Java服务器页面(JSP)页面负责处理所有的事情,例如,接收请求,执行业务逻辑,选择下一个页面。
这些复杂的事情,可能会导致混乱JSP页面编码和有害的扩展和维护的JSP页面。
模型--视图--控制器(MVC)模式编程代码分离成三个不同的区域,它已经解决了上述问题。
MVC可以实现J2EE应用程序的系统的分层和三层或多层的松散耦合,它是一个实现的定向动态内容的方式。
MVC模式把应用程序分成三个核心部件的模型,视图和控制器。
Struts是一个MVC实现。
它是一个开源Web应用框架,使用Servlet和JSP标记属于J2EE规范的一部分实现。
的Struts继承了MVC的特点和根据J2EE性状,实现一些相应的变化和扩展。
Struts的分离JSP的Java代码的JavaBean和Action类是MVC模式,数据传输三者间的分区模型,视图和控制器,演示各种类和JSP页面之间的连接配置文件,终于和它打算实现表现层,业务层和数据层的分离。
Struts的结构示于图1。
该模型包含业务逻辑交换数据持久层。
查看是负责生产的,什么是直接对用户可见,例如网页。
控制器层,接收来自客户端的请求,决定哪些业务逻辑需要的地方,下一站去哪里。
在Struts框架中,模型用业务逻辑的Java类。
JSP和Taglib是Struts的视图可以实现。
该控制器是被称为Servlet的J2EE组件,更具体一个ActionServlet的对象,这就决定什么逻辑被执行时,应该得到控制。
2基于ORM的Hibernate框架
Java数据库连接(JDBC),面向对象的软件和关系数据库的工作是一项复杂的任务,因为数据是如何表示的对象与关系数据库之间存在不匹配。
因此,使用JDBC,开发人员必须写纯结构化查询语言开发(SQL)语句对象模型的映射数据表示关系数据模型及其相应的数据库架构。
Hibernate介绍
Hibernate是一个灵活和强大的对象--关系映射(ORM)的解决方案,Java类映射到数据库表。
这是一个强大的,高性能的对象关系持久性和查询服务。
Hibernate允许开发人员在其自己的便携式SQL扩展来表达查询(Hibernate查询语言(HQL)),以及在本地的SQL,或面向对象的标准和示例应用程序编程接口(API)。
Hibernate自身需要照顾这个映射使用XML文件,以便开发人员不需要编写代码。
Hibernate是一个开放源代码和用于开发和生产部署,这是一个桥梁Java应用程序关系数据库之间和负责的Java对象和关系数据之间的映射,它是免费的。
里面的Hibernate包JDBC,它提供了面向对象的数据库访问到上层应用的API访问数据库的操作。
因此,开发人员可以使用对象编程思想,充分操作数据如图2所示,休眠在于中间层和应用程序之间提供了持续的服务,Hibernate的映射类类的属性和映射文件()本身的数据表行database。
应用程序与数据库由持久化对象(PO)直接处理数据。
库,关怀不必要底层数据库结构。
Hib