`
wonderfan
  • 浏览: 14075 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
最近访客 更多访客>>
社区版块
存档分类
最新评论

STRUTS2 IN DETAIL

阅读更多
when requests are received at the servlet container,they are forwarded to either a servlet or a filter that will handler processign the request. in struts2, a filter is used; and the class for handling the request is the filterdispatcher class.
the filter and a dispatcher class are the heart of the struts2 framewotk. together, they provide access to the infrastructure that will be needed to process the request. upon startup, implementations of configurable elements in the framework including configurationmanager,actionmapper and objectfactory are loaded. with respect to processign the request ,the struts2 filter performa the following: serves static content; determines the action configuration;create the action context;create the action proxy;performs cleanup. when the actionproxy class instance is created and  cpnfigued ,the excute() method is invoked. this signals that the preparation of the action is complete and the real processing of the action is about to start.
the actioninvocation object manages the execution environment and contains the conversational state of the action being processed, this class is the core of the actionproxy class. the execution environment is made up of three different components;action,interceptors and results. one of the first task that the actioninvocation performs is to consult the configuration being used and to create an instance of the action. unlike struts and other frameworks that reuse action instances,struts2 creates a new action object instance for each and every request that is received. there is a slight performance overhead with this approach,but you gain the adavantage that the object can behave as plain old java object.
interceptors provide a simple way to add prcoessing logic around the method being called on the action. they allowq for cross-functional features to be applied to actions in a convenient and consistent way, avoiding the need for adding code to each and every action that over time would create additonal maintenance overhead.  this funcitonality is similar to that provided by servlet filters and the jdk proxy object.
each action will have many interceptors configured. these interceptors are invoked in the order that they are configured. after they are all applied to the request, the actionss method that processes the logic for the request is called.
after the processing of the action is complete, it is time to turn your attention to the result. the method of the actin class that processes the request retruns a string as the result which is mapped via configuration to an implementation of the result  intreface or the action can directyly returnn a result object instance. the result interface is very similar to an action class; it contains a single method that generates a response for the user.
the only requirement for actions in struts is tha three must be one no-argument method that returns either a string or result object. if the no-argument method is not specified, the default behavior is to use the execute method. otherwise, you will need addtional configuration to specify the method name. the actionsupport class is more interesting. it implements the action interface and provides an implementation for the execute method the returns the success value. four other interface are also implemented .the validateable and validationaware interfaces as you would expect,provide the support for validation. these alloww the action to provide programmatic,annotation-based and declarative xml-based validation. the textprovider and localeprovider interfaces provides support for localization and internationalization.
interceptors allow for crosscutting functionality to be implemented separatley from the action as well as the framework. the first difference is that the contents of the stack are made up of four levels: temporary objects: these objects need temporary storage during the processing of a request. model object: when the action implements the modeldriven interface ,the model object is placed on the stack in front of the actipn that is being executed, this level will not be present if the interface is not implemented by the action. action object: this is the action that is currently being executed. named objects:any object can be assigned an identifier making it a named object. with the value stack, you are searching for or evaluarting a particular expression using object graph navigational language.
the result type provide the implementation details for the type of information that is retruned to the user. tag libraries provide the intersection between actions and views allowing dynamic informarion from the actions to be rendered as well as making rendering on the information to display at runtime.
following are the three main components that make up the struts2 tag architecture:model: the model component in the diagram is the component class. the web.xml configuration file is a j2ee configuration file that determines how elements of the http request are processed by the servlet container. the zero configuration terminology is used to describle the departure from a a pure xml-nased configuration to an annotation-based configuration.
you saw the interfaces  that need to be implemented to create custom result types and interceptors what interceptors look like and how to wire actions and configure them. use the new features direnctly in your web applications. bulder the new features into plug-in.
分享到:
评论
2 楼 gembler 2008-12-21  
wonderfan 写道
TALK ABOUT THE HTTO IN DETAIL

how?
1 楼 maleo 2008-12-21  
不知所云,还不如用汉语说呢,英语不好就不要拿出来,另外写错单词了

相关推荐

    Struts 2实战 struts2 in Action

    根据提供的文件信息,我们可以从《Struts 2实战 Struts2 in Action》这一书籍中提炼出与Struts 2框架相关的多个重要知识点。Struts 2是一个基于Java的开源Web应用框架,它继承了Struts 1的优点并进行了大量的改进和...

    Struts2实战(Struts2 In Action中文版)

    **Struts2实战——《Struts2 In Action中文版》** 《Struts2 In Action》是一本专为Java开发者设计的实战指南,旨在深入解析Struts2框架的使用与实践。Struts2作为一款强大的MVC(Model-View-Controller)框架,极...

    Struts 2实战 Struts 2 in action 的中文版

    根据提供的信息,我们可以推断出这是一本关于Struts 2框架的书籍——《Struts 2实战 Struts 2 in action 的中文版》。本书主要介绍了Struts 2框架的相关概念、工作原理以及实际应用案例等内容。接下来,我们将根据...

    Struts2 in action(struts2实战)

    通过阅读《Struts2 in action》这本书,你可以深入学习Struts2的各个方面,包括最佳实践、高级特性和案例分析,从而在实际项目中更加熟练地运用这个框架。无论你是初学者还是经验丰富的开发者,这本书都将为你的Java...

    Struts2 in action中文版+配套源代码

    "Struts2 in Action" 是一本深入探讨Struts2框架的专业书籍,旨在帮助开发者掌握这一框架的核心概念和实践技巧。这本书的中文版不仅提供了理论知识,还附带有配套的源代码,方便读者进行实践操作,加深理解。 ...

    Manning - Struts 2 in Action源码

    通过阅读README,你可以了解如何配置开发环境,如何编译和部署`Struts2InAction.war`这个Web应用。 `Struts2InAction.war`是一个预打包的Web应用程序,它是按照Maven或者Ant等构建工具的标准结构组织的。这个WAR...

    Struts2 in action

    ### Struts2实战详解 #### 一、Struts2框架简介与MVC模式解析 **Struts2** 是一个开源的Web应用框架,基于Java语言编写,它继承了Struts1的一些优秀特性,并在此基础上进行了大量的改进和扩展。Struts2最大的特点...

    struts2 in action 源码

    struts2 in action 源码

    Struts2 in action 中文版

    《Struts2 in Action》中文版是一本深入探讨Struts2框架的专业书籍,该书不仅提供了详尽的理论知识,还包含了大量的实战案例,对于希望掌握Struts2框架的开发者来说,是一本不可或缺的参考书。 ### Struts2框架概览...

    Struts2 in action 中文版.pdf

    《Struts2 in Action》是一本深入探讨Struts2框架的权威著作,中文版的发布使得国内开发者能够更方便地理解和应用这一强大的Java Web开发框架。Struts2是Apache软件基金会旗下的一个开源项目,它是MVC(Model-View-...

    struts2 in action 中文版 英文版 源代码 合集

    《Struts2 in Action》是一本深入介绍该框架的专业书籍,无论是中文版还是英文版,都为读者提供了全面理解和实践Struts2的知识。 中文版的《Struts2 in Action》为中文阅读者提供了方便,使得理解复杂的框架概念变...

    struts2 in action

    struts2 in actionstruts2 in actionstruts2 in actionstruts2 in actionstruts2 in actionstruts2 in actionstruts2 in action

    Struts2InAction中文+源代码

    《Struts2 in Action》是一本深入探讨Struts2框架的权威著作,中文版的发布使得更多的中国开发者能够轻松理解并掌握这一强大的MVC框架。这本书不仅提供了理论知识,还结合了实际应用,通过SampleApplication的源代码...

    struts2 in Action

    如果你想自学struts2,此文档是很好的自学宝典,经典struts2 in Action,能帮你建立整体的struts2思想,你还在犹豫什么

    Struts2 in Action

    《Struts2 in Action》是Java Web开发领域中一本经典的实战指南,主要针对Apache Struts 2框架进行深入探讨。这本书结合理论与实践,详细介绍了如何有效地使用Struts 2来构建高性能、可维护的Web应用程序。Struts 2...

Global site tag (gtag.js) - Google Analytics