资源预览内容
第1页 / 共34页
第2页 / 共34页
第3页 / 共34页
第4页 / 共34页
第5页 / 共34页
第6页 / 共34页
第7页 / 共34页
第8页 / 共34页
第9页 / 共34页
第10页 / 共34页
第11页 / 共34页
第12页 / 共34页
第13页 / 共34页
第14页 / 共34页
第15页 / 共34页
第16页 / 共34页
第17页 / 共34页
第18页 / 共34页
第19页 / 共34页
第20页 / 共34页
亲,该文档总共34页,到这儿已超出免费预览范围,如果喜欢就下载吧!
点击查看更多>>
资源描述
Click to edit Master title style,Click to edit Master text styles,Second level,Third level,Fourth level,Fifth level,*,An Introduction To the Spring M.V.C.Framework,Reference From Website By,Tom Kochanowicz,An Introduction To the Spring,Outline,Where weve been,M.V.C.Frameworks,Why Use Spring Framework,IoC(Inversion of Control),Examples,OutlineWhere weve been,Where weve been,Web based programming“The Servlet Way”,JSP or HTML Form,Submit to servlet,Servlet Processes data&Outputs information,Works well for small applications but can quickly grow out of control because HTML,scrip-lets,java script,tag-libraries,database access,and business logic makes it difficult to organize.,Put simply,lack of structure can cause a“soup”of different technologies.,JSPs compile to Servlet,Where weve beenWeb based prog,“A Better Way?”,Separate the Data Access,Business Logic and Presentation using a M.V.C.Framework.,Choose a M.V.C.framework:,WebWork,Spring,Struts,Java-Server-Faces,Tapestry plus“many more”,“A Better Way?”Separate the Da,Things change:,Struts,by far is the most popular;same creator of Struts(Craig McClanahan)is the co-spec leader of Java Server Faces.,Webwork evolved to Webwork2,Tapestry-has been around for awhile.,Spring “newer”of the frameworks.Integrates well with any other framework or by itself.,Things change:Struts,by far i,Why Spring Framework?,All frameworks integrate well with Spring.,Spring offers an open yet structured framework,using dependency-injection,a type of inversion-of-control to integrate different technologies together.,Consistent Configuration,open plug-in architecture,Integrates well with different O/R Mapping frameworks like Hibernate,Easier to test applications with.,Less complicated then other frameworks.,Active user community.,Why Spring Framework?All frame,Want to integrate your existing web-app with a Spring middle tier?,Struts,http:/ Work,http:/ to integrate your existin,What if I like Microsoft.NET?,Then try,Spring Framework.NET,http:/ if I like Microsoft.NET?,Why I chose to learn the Spring framework,Because of IoC/Dependency Injection you can easily change configurations.,Addresses end-to-end requirements,not just one part.,Spring is well organized and seems easier to learn then struts.,Portable across deployment environments.,Integrates well with Hibernate,Meant to wet your,appetite and note be compressive.,Why I chose to learn the Sprin,Downsides:,Not as mature as other frameworks(but very stable).,Market share is small at this time,but rapidly growing.,dependency-injection(Inversion-of-control)is a different way of thinking(This is actually a plus).,Not a-lot of tool support for Spring yet.A plug-in for Eclipse is available.,Depends on who you ask.,Downsides:Not as mature as oth,Spring is not just a,Presentation,M.V.C.Framework:,Persistence support:,Spring also supports A JDBC Framework that makes it easier to create JDBC Apps.,Supports O/R mapping Frameworks making it easier to use O/R tools like Hibernate&JDO,Spring offers,Connection Pooling,for any POJO.,Supports,transaction framework,Has good support for aspect-oriented-programming,Plus much more.,Spring is not just a Presentat,What is dependency-injection&why use it?,Dependency-injection(a type of IoC)is when you let your framework control your application.,Spring links objects together instead of the objects linking themselves together.,Spring object linking is defined in XML files,allowing easy changes for different application configurations thus working as a plug in architecture.,Dependency injection is where the control of the application is inverted to the framework.This control is configured in the framework with an XML file.,What is dependency-injection&,Without,Dependency-Injection/IoC,Object A,Object B,Object C,creates,creates,An object creating its dependencies without IoC leads to tight object coupling.,Without Dependency-Injection/I,Object A,Object B,Object C,setB(IB),setC(IC),Object A contains setter methods that accept interfaces to objects B and C.This could have also been achieved with constructors in object A that accepts objects B and C.,With Dependency-Injection/IoC,Allows objects to be created at higher levels and passed into object so they can use the implementation directly,Object AObject BObject CsetB(I,Spring supports two types of dependency injection,“setter-based”,and,“constructor based”,injection,Code Example of,setter based injection,:,myemail.address,*beans are accessed by there“bean name”,Interpretation of the above code:,Person,person,=new Person();,person.setEmail(“,myemail.address,”);,This code creates a Person object and calls the setEmail()method,passing in the string defined as a value.,Spring supports two types of d,Constructor based injection,/data/file1.data,Interpretation of the above code:,FileDataReader,fileDataReader,=new FileDataReader(“/data/file1.data”);,DataProcessor,fileDataProcessor,=new DataProcessor(fileDataReader,);,An-Introduction-To-the-Spring-MVC-Framework:对Spring-MVC框架的
点击显示更多内容>>

最新DOC

最新PPT

最新RAR

收藏 下载该资源
网站客服QQ:3392350380
装配图网版权所有
苏ICP备12009002号-6