1 / 15

Struts2.0

Struts2.0. Revolution to next generation. Basic features of struts2.0. Struts2 vs struts1.1. Architecture of struts2.0. Basic flow of struts2.0. How to configure the plugins for struts2 in netbeans IDE. Some basic components in brief. Reference. Topics discussed …. Features.

isi
Download Presentation

Struts2.0

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Struts2.0 Revolution to next generation Avishek Arang :: avishekarang@gmail.com

  2. Basic features of struts2.0. • Struts2 vs struts1.1. • Architecture of struts2.0. • Basic flow of struts2.0. • How to configure the plugins for struts2 in netbeans IDE. • Some basic components in brief. • Reference Topics discussed … Avishek Arang :: avishekarang@gmail.com

  3. Features Page-based Navigation Built-in Ajax Support: DWR and Dojo Spring as default inversion of control container Changed from front-controller servlet to filter Much better client-side validation support QuickStart and Annotations JSF Support Built-in support for testing with StrutsTestCase Avishek Arang :: avishekarang@gmail.com

  4. Comparison Struts2.0 Struts1.1 • Action • Action or POJO • Result • struts.xml • FilterDispatcher • Interceptors • Action-validation.xml • Action • ActionForm • ActionForward • struts-config.xml • ActionServlet • RequestProcessor • validation.xml Avishek Arang :: avishekarang@gmail.com

  5. Architecture Avishek Arang :: avishekarang@gmail.com

  6. Flow of Struts 2 based Application User Sends request. FilterDispatcher determines the appropriate action. Interceptors are applied.   Execution of Action.   Output rendering.   Return of Request(reverse order).   Display the result to user. Avishek Arang :: avishekarang@gmail.com

  7. Select Tools > Plugins: To configure struts plugins to netbeans IDE. Avishek Arang :: avishekarang@gmail.com

  8. Configure Plugins: org-netbeans-modules-web-frameworks-struts2.nbm org-netbeans-modules-web-frameworks-struts2lib20011.nbm Avishek Arang :: avishekarang@gmail.com

  9. Struts 2 Core components Struts 2 Core components are Action handler, Result Handler and Custom Tags.  Action handlerAction handler interacts with other layers. Result HandlerResult handler actually dispatches the request to view. Custom Tags Custom Tags are used render the dynamic content. InterceptorsThe Interceptors are used to specify the "request-processing lifecycle" for an action. Interceptors are configured to apply the common functionalities like workflow, validation etc.. to the request. Interceptors code is executed before and after an Action is invoked Expression Language(ONGL- Object Graph Notation Language) Avishek Arang :: avishekarang@gmail.com

  10. struts.xml <struts> <include file="struts-default.xml"/> <constant name="struts.custom.i18n.resources" value="MessageResources" /> <package name="default" extends="struts-default"> <action name="list" class="web.DefectsList"> <result>/pages/defects.jsp</result> </action> <action name="action_*" method="{1}" class="web.DefectsAction"> <result name="input">/pages/editDefect.jsp</result> <result type="redirect">list.action</result> </action> </package> </struts> Avishek Arang :: avishekarang@gmail.com

  11. <include> Used to modularize application. Always a child of <struts> tag. Only attribute “file” implies the config file. <include file=“module1-config.xml”> Order of including files are important. explicitly include: “struts-default.xml” and the “struts-plugin.xml” files Avishek Arang :: avishekarang@gmail.com

  12. <package> name - unique. extends - “struts-default”. namespace- admin, knowledgecenter, test. Abstract-if “true” actions configured will not be accessible via the package name. Avishek Arang :: avishekarang@gmail.com

  13. Interceptor They provide a way to supply pre-processing and post-processing around the action. examples include exception handling, file uploading, lifecycle callbacks and validation. <interceptors> <interceptor name="autowiring“ class="interceptor.ActionAutowiringInterceptor"/> </interceptors> <action name="my" class="com.fdar.infoq.MyAction" > <result>view.jsp</result> <interceptor-ref name="autowiring"/> </action> Avishek Arang :: avishekarang@gmail.com

  14. com.opensymphony.xwork2 Interface Action Field Summary static StringERROR The action execution was a failure. static StringINPUT The action execution require more input in order to succeed. static StringLOGIN          The action could not execute, since the user most was not logged in. static StringNONE          The action execution was successful but do not show a view. static StringSUCCESS          The action execution was successful.   Method Summary  Stringexecute()           Where the logic of the action is executed. Avishek Arang :: avishekarang@gmail.com

  15. Bibliography - www.roseindia.com- Starting Struts2 by Ian Roughley [free ebook].- Struts 2 Design and Programming: A Tutorial by Budi Kurniawan. Avishek Arang :: avishekarang@gmail.com

More Related