下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、器给每个请求产生许多可丢弃的对象,并且不会导致性能和垃圾回收问题。Struts2技术简介1. MVC设计模式介绍MVC模式是“ Model-View-controller的缩写,中文翻译为模式-试图-控制器”。MVC应用程序总是由这三个部分组成。Eve nt导致Con troller改变 Model或View,或者同时改变两者。只要Controller改变了 Models的数据或者属性,所有依赖的View都会自动更新。类似的,重要Controller改变了 View,View会从潜在的 Model中获取数据来刷新自己。MVC模式最早是 Smalltalk语言研究团提出的,应用于交互应用程序中。
2、Java语言是面向对象语言,很自然的SUN在应用程序事例中就推荐MVC模式作为开发Web应用的架构模式。MVC模式是一种架构模式,其实需要其他模式协作完成。在J2EE模式目录中,通常采用service to worker 模式是新,而serviceto worker模式可由集中控制器模式,派遣器模式和Page Helper模式组成。2. Struts2 简介虽然Struts2号称是一个全新的框架,但这仅仅是相对Struts1而言。Struts2与Struts1相比,确实有很多革命性的改进,但它并不是新发布的新框架。从某种程度上来讲,Struts2没有继承 Struts1的血统,而是继承WebW
3、ork 的血统。Struts2是WebWork的升级,而不是一个全新的框架,因此稳定性、性能等各方面都有很好的保证:而且吸收了 Struts1和WebWork两者的优势。Struts2 Action类可以实现一个 Action接口,也可实现其他接口,使可选和定制的服务成为可能。 Struts2提供一个ActionSupport基类去实现 常用的接口。 Action接口不 是必须的,任何有 execute标识的POJO对象都可以用作 Struts2的Action对象。Struts2Action对象为每一个请求产生一个实例,因此没有线程安全问题。实际上,servlet容Action可以通过初始化、
4、设置属性、调用方法来测试,依赖注入”支持也使测试更容易。Struts2直接使用 Action属性作为输入属性,消除了对第二个输入对象的需求。输 入属性可能是有自己(子)属性的 rich对象类型。Action属性能够通过 web页面上的 taglibs访问。Struts2也支持 ActionForm 模式。rich对象类型,包括业务对象,能够用 作输入/输出对象。这种ModelDriven 特性简化了taglib对POJO输入对象的引用。Struts2可以使用 JSTL但是也支持一个更强大和灵活的表达式语言“Object GraphNotation Language ”(OGNL)。Struts
5、2 使用 “ ValueStack ”技术,使 taglib 能够访问值而 不需要把你的页面(view)和对象绑定起来。ValueStack策略允许通过一系列名称相同但 类型不同的属性重用页面(view)。Struts2使用OGNL进行类型转换。提供基本和常用对象的转换器。2附录2Technical Overview1. MVC desig n patter n descripti onMVC pattern is Model-View-controllerof the acronym, the Chinese translationfor mode - trying to - Control
6、ler.MVC applicationsare always by these threecomponents. Event (events) result in Model or Controller to change the View, or to change both at the same time. Models change as long as the Controller of the data or attributes, all depend on View is updated automatically. Similarly, the important Contr
7、oller changed the View, View of the Model from the potential to obtain data to refresh themselves. MVC pattern was first made smalltalk Ianguage research group applied to in teractiveapplicati ons.Java Ian guage is object-orie nted Ian guage, it isnatural that in the applicati on in sta nces SUN rec
8、omme nding MVC model as a framework for developing Web application model. MVC model is an architectural pattern, in fact, other models need to be completed in collaboration.In the J2EE pattern catalog arecom monly used service to worker patter n is n ew, and the service to worker patter n may be foc
9、used on con trol mode, sending mode and the Page Helper patter n.2. Struts2 In troductio nAlthough the claims is a new Struts2 framework, but it is only in terms of relative Struts1. Struts2 with Struts1 tha n there are in deed many revoluti onary improveme nts, but it is not a new release of the ne
10、w framework, but in another prominent framework: WebWork developed on the basis of the. To some extent, Struts2 does not inheritStrutsls ancestry, but the succession WebWork lineage. Struts2 is the WebWork upgrade, rather tha n an en tirely new framework, therefore the stability, performa nee and ot
11、her areas have a very good assura nee:it absorbed the adva ntages of both Strutsl andWebWork, therefore, is a very worth the wait framework.Struts2 Action class can impleme nt an Action in terface and other in terfaces can alsobe achieved to enable optionaland custom services possible. Struts2 provi
12、des aActi on Support to achieve com mon base class in terface. Action in terface is not n ecessary, any POJO object execute identity can be used as an object Struts2 in Ac tion. Struts2 Acti on object for each in sta nee of a request to gen erate a, there is no thread -safety problems. (In fact, ser
13、vlet containers gen erate many for each request can be discarded objects, and will no t lead to performa nee and garbage collecti on issues). Struts2 Action does not depend on the container, allowing Action out of the container to be tested separately. If necessary, Struts2 Action can still access t
14、he original Request and Resp on se,however, othereleme ntsto reduce or elim in ate direct access toHttpServetRequest and HttpServletResp onse n ecessary. Struts2 Action can be in itialized, set properties, call methods to test, depe ndency inject ion support also makes testi ng easier. Struts2 using the Action attribute directly as in put properties, el i min at ing the n eed for the sec ond in put object n eeds. In put properties may have their own (sub) attribute the rich object type. Action properties able to access web pages on the
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年虚拟现实教育软件公司外部法律顾问聘请管理制度
- 2026年蔬菜种植公司质量检测人员培训与考核管理制度
- 金融科技领域研发外包的机遇与挑战
- 2025海南琼海市嘉积供销合作社招聘企业工作人员易考易错模拟试题(共500题)试卷后附参考答案
- 2025河北张家口市桥东区事业单位招聘笔试易考易错模拟试题(共500题)试卷后附参考答案
- 2025江西省高速公路投资集团限责任公司秋季招聘374人易考易错模拟试题(共500题)试卷后附参考答案
- 卫生局医院笔试题库及答案
- 2025年上学期高一化学应用题专项强化试题(二)
- 教师师德师风题库及答案
- 嘉德消防培训考试题库及答案
- 武汉市江夏文化旅游发展集团有限公司招聘笔试题库2025
- 2025宜宾环保停工通知书
- 工业厂房安全生产管理细则
- 2026中国证券登记结算有限责任公司招聘笔试考试参考试题及答案解析
- 2025年(完整版)大学英语四级真题及答案(多套题及详解)
- 2026年能源加工公司煤炭料场管理制度
- 2025江苏徐州云龙区基层社区工作者招聘25人考试笔试模拟试题及答案解析
- 汽车保养快修课件
- 2025江苏扬州高邮市交通产业投资集团有限公司招聘拟聘用笔试历年参考题库附带答案详解
- 小学硬笔书法分级教学方案
- 口语交际(劝说、建议)
评论
0/150
提交评论