Struts 2.ppt_第1页
Struts 2.ppt_第2页
Struts 2.ppt_第3页
Struts 2.ppt_第4页
Struts 2.ppt_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、July 2008,1,Struts 2,Web Frameworks Comparison JUG Meeting #0002, 8th of July 2008,July 2008,I. Origins and overview,Action based framework MVC2 pattern POJO based,July 2008,II. Basic Architecture,The web browser requests a resource (/mypage.action, etc) The Filter Dispatcher looks at the request an

2、d determines the appropriate Action The Interceptors automatically apply common functionality to the request, like workflow, validation, and file upload handling The Action method executes buisness code, returning a String result The Result renders the output to the browser, be it HTML, images, PDF,

3、 or something else,July 2008,III. Core features,Ognl expression language similar with jsp expression language +type conversions for Maps,Lists primitives not just for Strings +works in other template enviroments velocity,freemarker + calling methods, lambda expressions + projection selecting propert

4、ies from list of objects and creating another temp list (usefull for a select),Results Many result types including jsp,velocity,freemarker, Jasper reports, Xsl,stream,Actions - Instantieted at every request no threading issues - Simple POJOs with any methods for execute() - Not tied with the Servlet

5、 api better testability - Namespace organization,Interceptors Stacking interceptors Many prebuild like Params,FileUpload, ModelDriven,Token,Value Stack - stack of different scopes that is traversed when looking for a value from the view : Temporary obj,Model Object,Action Object,Named Objects(#sessi

6、on), #request,#application,#parameters); - uses Ognl to reffer to scoped properties - resolves properties with same name in different scopes eg. 1.userid,Tag library - based on freeMarker all HTML output produced by tags can be easily customized,July 2008,IV. Comparison criterias,Ajax support Dojo b

7、uilt-in; from version 2.1.0 as a plugin Plugin for JSON s:head theme=“ajax” enables partial submit,validation for forms Many pre-build ajaxed components like tabbedpane,tree,textarea,autocompleter Bookmarkability Has namespaces so bookmarking actions with request parameters is easy SmartURL further

8、enhancements Validation Server side validation in actions with methods or annotations Client validation with xml defined validators many prebuild like email, phone numbers,any regex Ajax validation out of the box with Dojo, can use any xml defined validators,July 2008,IV. Comparison criterias,Testab

9、ility Testing possible by manually instantiating framework objects : Dispatcherand ActionProxy instantiate actions Request and response can be moked with objects like MockServletContextservletContext,MockServletConfig,MockHttpServletRequest,MockHttpServletResponse Execute the desired Method Post and

10、 Redirect Support via redirect-action also possibility to transmit static or dinamic parameters from First action to second Also resovles duplicate posts via Token Session Interceptor blocks subsequent requests until the first request is complete Internationalization Resource boundles for internationalization very customizable at different levels ActionCperties Iperties At package level perties Global resource properties via struts.custom.i18n.resources defined in struts.xml At Ui level , properties fetched with getTe

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论