Struts2  Reinventing Struts1 Wheel Ori Dar Consultant and Architect, AlphaCSP
Agenda <ul><li>Introduction </li></ul><ul><li>Background </li></ul><ul><li>Framework features review </li></ul><ul><ul><li...
Introduction::In a nutshell (1) <ul><li>Action Based MVC Framework </li></ul><ul><ul><li>FilterDispatcher : controller </l...
Introduction::In a nutshell (2) <ul><li>First released in Oct. 2006 </li></ul><ul><ul><li>Merger of Struts1 and WebWork2 <...
Introduction::In a nutshell (3) <ul><li>Extensible via plugins </li></ul><ul><ul><li>Other frameworks integration </li></u...
Introduction::HelloWorld <ul><li>Controller: FilterDispatcher </li></ul>< filter > < filter-name >action2</ filter-name > ...
Introduction::HelloWorld, Model public   class  HelloWorld { private  String  message = &quot;Hello World. Time is: &quot;...
Introduction::HelloWorld, View <ul><li>View: HelloWorld.jsp </li></ul><ul><ul><li>Utilizes a single struts taglib </li></u...
Introduction::HelloWorld <ul><li>struts.xml: </li></ul><ul><ul><li>Actions mapping </li></ul></ul><ul><ul><li>Results mapp...
Agenda <ul><li>Introduction </li></ul><ul><li>Background </li></ul><ul><li>Framework features review </li></ul><ul><ul><li...
Background ::S2 Vs. S1 Configuration Lifecycle Validation EL View binding Form binding Threading Servlet API Action Role A...
Background ::Interceptors <ul><li>Actions pre & post processing mechanism </li></ul><ul><li>Like Spring AOP, EJB3 intercep...
Background ::Interceptors <ul><li>< package   name= &quot;struts-default&quot;   abstract= &quot;true&quot; > </li></ul><u...
Background ::V alueStack  <ul><li>The  ValueStack is a storage for request domain model </li></ul><ul><li>Serves as contex...
Background ::OGNL   <ul><li>ValueStack is referenced and manipulated by OGNL  </li></ul><ul><li>OGNL is also used instead ...
Background :: Other features <ul><li>Tag Library </li></ul><ul><ul><li>Form component tags </li></ul></ul><ul><ul><li>Ajax...
Background ::  Theme example < s:form   action= &quot;login&quot;   namespace= &quot;/&quot;  validate= &quot;true&quot; >...
Background :: Other features <ul><li>Reasonable defaults: struts-default </li></ul><ul><ul><li>Result types </li></ul></ul...
Agenda <ul><li>Introduction </li></ul><ul><li>Background </li></ul><ul><li>Framework features review </li></ul><ul><ul><li...
Features ::Action Configuration < action   name= &quot;listEmployees&quot;   class= &quot;actions.model.Employee&quot;  me...
Features :: Action Configuration <ul><li>Wildcards can be used for mapping </li></ul><ul><li>Mandates naming convention </...
Features ::Annotation Config. <ul><li>Annotation based configuration  </li></ul><ul><ul><li>Can make XML utterly redundant...
Features :: View technology <ul><li>Result types </li></ul><ul><ul><li>JSP : dispatcher </li></ul></ul><ul><ul><li>Velocit...
Features ::Page flow 1 3 4 5 6 7 8 2
Features ::Page flow <ul><li>User Sends HTTP request </li></ul><ul><li>FilterDispatcher determines appropriate action </li...
Features :: Form binding < s:form   action= &quot;login&quot;   validate= &quot;true&quot;   namespace= &quot;/&quot; > < ...
Features ::Table sorting <ul><li>Using Table Tags plugin </li></ul><ul><ul><li>Undocumented </li></ul></ul><ul><ul><li>Loo...
Features ::Table sorting <ul><li>< display:table   class= &quot;grid&quot;   defaultsort= &quot;1&quot;   id= “contact&quo...
Features :: Pagination <ul><li>Used the display tag library internal pagination support </li></ul><ul><ul><li>Supports int...
Features ::Validation <ul><li>Uses 12 out-of-box field validators </li></ul><ul><li>Uses expression validators for complex...
Features ::Validation <ul><li>Annotation vs. xml example </li></ul><ul><li>(No annotated version for Struts1) </li></ul>@E...
Features ::Client side validation <ul><li>Automatic creation of client side validation </li></ul><ul><ul><li>No client sid...
Features ::Ajax <ul><li>Dojo is embedded for Ajax tags </li></ul><ul><li>Dojo head tag enables JS debugging </li></ul><ul>...
Features :: Ajax autocompleter <ul><li>View </li></ul>Action < s:url   id= &quot;acUrl&quot;   action= &quot;getDepts&quot...
Features ::Error handling <ul><li>Validation error feedback tags </li></ul><ul><ul><li>actionerror </li></ul></ul><ul><ul>...
Features ::Error handling <ul><li>Exception interceptor </li></ul><ul><ul><li>maps exceptions to result error pages </li><...
Features ::I18N support <ul><li>Built on top of Java I18N support </li></ul><ul><li>Bundles can be defined in: </li></ul><...
Features ::Documentation <ul><li>Apache Struts 2  Documentation </li></ul><ul><li>WIKI   </li></ul><ul><li>Struts Showcase...
Agenda <ul><li>Introduction </li></ul><ul><li>Background </li></ul><ul><li>Framework features review </li></ul><ul><ul><li...
Summary::Pros <ul><li>Extensible plugin framework </li></ul><ul><li>Modular and clean architecture  </li></ul><ul><li>Anno...
Summary::Pros <ul><li>Fast learning curve </li></ul><ul><li>Intuitive </li></ul><ul><li>Restful URL action mapper </li></u...
Summary::Cons <ul><li>Unorganized documentation </li></ul><ul><li>Lack of API documentation </li></ul><ul><li>No clear roa...
Summary::When to use <ul><li>Use when </li></ul><ul><ul><li>Migrating from legacy framework </li></ul></ul><ul><ul><li>Nat...
<ul><li>Thank  </li></ul><ul><li>You ! </li></ul>
Upcoming SlideShare
Loading in...5
×

Struts2

8,534

Published on

Struts2 by Ori Dar from AlphaCSP
www.alphacsp.com

Published in: Business, Technology
1 Comment
11 Likes
Statistics
Notes
  • Nice, brief introductory presentation for beginners..
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
8,534
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
539
Comments
1
Likes
11
Embeds 0
No embeds

No notes for slide
  • Struts2

    1. 2. Struts2 Reinventing Struts1 Wheel Ori Dar Consultant and Architect, AlphaCSP
    2. 3. Agenda <ul><li>Introduction </li></ul><ul><li>Background </li></ul><ul><li>Framework features review </li></ul><ul><ul><li>Configuration </li></ul></ul><ul><ul><li>View technology </li></ul></ul><ul><ul><li>Page flow </li></ul></ul><ul><ul><li>Form binding </li></ul></ul><ul><ul><li>Table sorting </li></ul></ul><ul><ul><li>Pagination </li></ul></ul><ul><ul><li>Validation </li></ul></ul><ul><ul><li>AJAX </li></ul></ul><ul><ul><li>Error handling </li></ul></ul><ul><ul><li>I18n support </li></ul></ul><ul><ul><li>Documentation </li></ul></ul><ul><li>Summary </li></ul>
    3. 4. Introduction::In a nutshell (1) <ul><li>Action Based MVC Framework </li></ul><ul><ul><li>FilterDispatcher : controller </li></ul></ul><ul><ul><li>Action : POJO model </li></ul></ul><ul><ul><li>Result : view </li></ul></ul><ul><li>Comparable to </li></ul><ul><ul><li>Struts1 </li></ul></ul><ul><ul><li>Spring MVC </li></ul></ul><ul><ul><li>Stripes </li></ul></ul>
    4. 5. Introduction::In a nutshell (2) <ul><li>First released in Oct. 2006 </li></ul><ul><ul><li>Merger of Struts1 and WebWork2 </li></ul></ul><ul><ul><li>Uses WebWork2 architecture </li></ul></ul><ul><li>Modern and clean architecture </li></ul><ul><li>Xml or annotations </li></ul><ul><ul><li>Actions </li></ul></ul><ul><ul><li>Validators </li></ul></ul><ul><ul><li>Datatype convertors </li></ul></ul>
    5. 6. Introduction::In a nutshell (3) <ul><li>Extensible via plugins </li></ul><ul><ul><li>Other frameworks integration </li></ul></ul><ul><ul><li>Embedding other application modules </li></ul></ul><ul><li>Intuitive, fast learning curve </li></ul><ul><li>Other core components </li></ul><ul><ul><li>Interceptors: controlling action pre and post processing </li></ul></ul><ul><ul><li>ValueStack: central storage for request model data </li></ul></ul>
    6. 7. Introduction::HelloWorld <ul><li>Controller: FilterDispatcher </li></ul>< filter > < filter-name >action2</ filter-name > < filter-class >org.apache.struts2.dispatcher.FilterDispatcher</ filter-class > </ filter > < filter-mapping > < filter-name >action2</ filter-name > < url-pattern >/*</ url-pattern > </ filter-mapping > web.xml
    7. 8. Introduction::HelloWorld, Model public class HelloWorld { private String message = &quot;Hello World. Time is: &quot; ; public String execute () { message += new Date(); return &quot;success&quot; ; } public String getMessage() { return message ; } } action method returns a result code We don’t have to extend Action Boss … and no request, response in execute() Boss
    8. 9. Introduction::HelloWorld, View <ul><li>View: HelloWorld.jsp </li></ul><ul><ul><li>Utilizes a single struts taglib </li></ul></ul><ul><ul><li>The taglib is common for JSP, Velocity and FreeMarker </li></ul></ul>< % @ taglib prefix=&quot;s&quot; uri=&quot;/struts-tags&quot;%> < html > < body > < s:property value= “message“ /> </ body > </ html > Prints action’s message property. Unlike struts1, action is a POJO, and acts as a model
    9. 10. Introduction::HelloWorld <ul><li>struts.xml: </li></ul><ul><ul><li>Actions mapping </li></ul></ul><ul><ul><li>Results mapping </li></ul></ul>< action name= “hello“ class= &quot;com.alphacsp.actions.HelloWorld&quot; > < result name= “success“ >/pages/HelloWorld.jsp</ result > </ action > links action to view http://host:port/app/hello.action Use action name in URL invocation
    10. 11. Agenda <ul><li>Introduction </li></ul><ul><li>Background </li></ul><ul><li>Framework features review </li></ul><ul><ul><li>Configuration </li></ul></ul><ul><ul><li>View technology </li></ul></ul><ul><ul><li>Page flow </li></ul></ul><ul><ul><li>Form binding </li></ul></ul><ul><ul><li>Table sorting </li></ul></ul><ul><ul><li>Pagination </li></ul></ul><ul><ul><li>Validation </li></ul></ul><ul><ul><li>AJAX </li></ul></ul><ul><ul><li>Error handling </li></ul></ul><ul><ul><li>I18n support </li></ul></ul><ul><ul><li>Documentation </li></ul></ul><ul><li>Summary </li></ul>
    11. 12. Background ::S2 Vs. S1 Configuration Lifecycle Validation EL View binding Form binding Threading Servlet API Action Role Action Wildcards, annotations Independent via interceptors xml or annotations OGNL Value Stack Action JavaBean properties Instance per request Decoupled Model POJO (with execute) Struts2 Verbose Shared Action Form JSTL EL JSP mechanisms Action Form Single instance Dependant Controller Extends Action Struts1
    12. 13. Background ::Interceptors <ul><li>Actions pre & post processing mechanism </li></ul><ul><li>Like Spring AOP, EJB3 interceptors </li></ul><ul><li>Interceptors are packed in stacks </li></ul><ul><li>Custom interceptors and stacks can be added </li></ul><ul><li>No equivalent in Struts1 </li></ul>< action name= &quot;phoneBook&quot; class= &quot;com.alphacsp.actions.PhoneBook&quot; > < interceptor-ref name= &quot;acspStack&quot; /> < result >/pages/phoneBook.jsp</ result > </ action > struts.xml
    13. 14. Background ::Interceptors <ul><li>< package name= &quot;struts-default&quot; abstract= &quot;true&quot; > </li></ul><ul><li>< interceptors > </li></ul><ul><li>< interceptor name= &quot;params&quot; class= &quot;…&quot; /> </li></ul><ul><li>< interceptor-stack name= &quot;basicStack&quot; > </li></ul><ul><li>< interceptor-ref name= &quot;exception&quot; /> </li></ul><ul><li>< interceptor-ref name= &quot;servletConfig&quot; /> </li></ul><ul><li>< interceptor-ref name= &quot;prepare&quot; /> </li></ul><ul><li>< interceptor-ref name= &quot;checkbox&quot; /> </li></ul><ul><li>< interceptor-ref name= &quot;params&quot; /> </li></ul><ul><li>< interceptor-ref name= &quot;conversionError&quot; /> </li></ul><ul><li></ interceptor-stack > </li></ul><ul><li></ interceptors > </li></ul><ul><li>< default-interceptor-ref name= &quot;defaultStack&quot; /> </li></ul><ul><li></ package > </li></ul>Excerpt from struts-default.xml interceptor interceptor stack contains other interceptors the default stack for actions in package struts-default.xml
    14. 15. Background ::V alueStack <ul><li>The ValueStack is a storage for request domain model </li></ul><ul><li>Serves as context per request </li></ul><ul><li>“ Glues ” model and view </li></ul><ul><li>Accessed by interceptors & views </li></ul><ul><li>Stores action properties </li></ul><ul><li>Also stores message bundles </li></ul>
    15. 16. Background ::OGNL <ul><li>ValueStack is referenced and manipulated by OGNL </li></ul><ul><li>OGNL is also used instead of JSTL </li></ul>< s:textfield name= &quot;contact.email&quot; /> < s:text name= &quot;email&quot; /> phoneBook.jsp phoneBook.jsp retrieves email property of actions’ contact property from stack using OGNL retrieves localized message using email as key from stack using OGNL
    16. 17. Background :: Other features <ul><li>Tag Library </li></ul><ul><ul><li>Form component tags </li></ul></ul><ul><ul><li>Ajax UI component tags </li></ul></ul><ul><ul><li>Control tags: iterator, if/else… </li></ul></ul><ul><ul><li>Data tags: manipulate the ValueStack </li></ul></ul><ul><li>Datatype conversion framework </li></ul><ul><li>Themes: templates for customizing components markup </li></ul>
    17. 18. Background :: Theme example < s:form action= &quot;login&quot; namespace= &quot;/&quot; validate= &quot;true&quot; > < s:textfield cssClass= &quot;loginField&quot; size= &quot;25&quot; key= &quot;username&quot; /> < s:password cssClass= &quot;loginField&quot; size= &quot;25&quot; key= &quot;password&quot; /> < s:submit value= &quot;Login&quot; cssClass= &quot;button&quot; align= &quot;center&quot; /> </ s:form > Xhtml theme generates table and validation feedback. No themes in Struts1 login.jsp
    18. 19. Background :: Other features <ul><li>Reasonable defaults: struts-default </li></ul><ul><ul><li>Result types </li></ul></ul><ul><ul><li>Interceptor stacks </li></ul></ul><ul><li>Actions extending ActionSupport </li></ul><ul><ul><li>facilitates validation </li></ul></ul><ul><ul><li>facilitates localization </li></ul></ul><ul><li>Spring integration </li></ul><ul><ul><li>Dependency Injection interceptor </li></ul></ul><ul><ul><li>Full Spring lifecycle management </li></ul></ul>
    19. 20. Agenda <ul><li>Introduction </li></ul><ul><li>Background </li></ul><ul><li>Framework features review </li></ul><ul><ul><li>Configuration </li></ul></ul><ul><ul><li>View technology </li></ul></ul><ul><ul><li>Page flow </li></ul></ul><ul><ul><li>Form binding </li></ul></ul><ul><ul><li>Table sorting </li></ul></ul><ul><ul><li>Pagination </li></ul></ul><ul><ul><li>Validation </li></ul></ul><ul><ul><li>AJAX </li></ul></ul><ul><ul><li>Error handling </li></ul></ul><ul><ul><li>I18n support </li></ul></ul><ul><ul><li>Documentation </li></ul></ul><ul><li>Summary </li></ul>
    20. 21. Features ::Action Configuration < action name= &quot;listEmployees&quot; class= &quot;actions.model.Employee&quot; method= &quot;list&quot; > < result name= &quot;list&quot; type= &quot;dispatcher&quot; >/WEB-INF/list.jsp</ result > </ action > result type the view technology (default value: “dispatcher” for rendering JSP) result name action method should return a matching result code string (default value: “success”) action method within action class (default value: “execute”) action class action name matched by a URL
    21. 22. Features :: Action Configuration <ul><li>Wildcards can be used for mapping </li></ul><ul><li>Mandates naming convention </li></ul><ul><li>Makes XML much less verbose </li></ul>< action name= &quot;list*s&quot; class= &quot;actions.model.{1}&quot; method= &quot;list&quot; > < result name= &quot;list&quot; > /WEB-INF/list{1}s.jsp </ result > </ action > listEmployees.action is mapped to Employee class and listEmployees.jsp listDepartments.action is mapped to Department class and listDepartmrnts.jsp …
    22. 23. Features ::Annotation Config. <ul><li>Annotation based configuration </li></ul><ul><ul><li>Can make XML utterly redundant </li></ul></ul><ul><ul><li>Struts scans packages for action classes </li></ul></ul><ul><ul><li>Results are expressed via @Result </li></ul></ul>@Result ( name= &quot;list&quot; , value= &quot;/WEB-INF/list.jsp&quot; ) public class Employee extends ActionSupport { public String listEmployees() { // business logic goes here return &quot;list&quot; ; } } “ list” result code is mapped to JSP. By extending ActionSupport, Employee is mapped as action by the package scanning mechanism
    23. 24. Features :: View technology <ul><li>Result types </li></ul><ul><ul><li>JSP : dispatcher </li></ul></ul><ul><ul><li>Velocity </li></ul></ul><ul><ul><li>FreeMarker </li></ul></ul><ul><ul><li>XSLT </li></ul></ul><ul><ul><li>Stream : PDF, MS Word etc. </li></ul></ul><ul><li>P lugins </li></ul><ul><ul><li>JasperReports </li></ul></ul><ul><ul><li>JFreeChart </li></ul></ul><ul><ul><li>JSON </li></ul></ul>
    24. 25. Features ::Page flow 1 3 4 5 6 7 8 2
    25. 26. Features ::Page flow <ul><li>User Sends HTTP request </li></ul><ul><li>FilterDispatcher determines appropriate action </li></ul><ul><li>Interceptors are applied </li></ul><ul><li>Action parameters are set (via params interceptor) </li></ul><ul><li>Action is being executed </li></ul><ul><li>The Result (view) renders the output </li></ul><ul><li>Optionaly: the view retrieves data from action </li></ul><ul><li>The result is displayed to the user </li></ul>
    26. 27. Features :: Form binding < s:form action= &quot;login&quot; validate= &quot;true&quot; namespace= &quot;/&quot; > < s:textfield cssClass= &quot;loginField&quot; key= &quot;username&quot; /> < s:submit key= &quot;login&quot; cssClass= &quot;button&quot; align= &quot;center&quot; /> </ s:form > login.jsp public class Login { private String username; public void setUsername(String username) { this . username = username; } } Login.java Form field parameters are injected into setter methods by the params interceptor
    27. 28. Features ::Table sorting <ul><li>Using Table Tags plugin </li></ul><ul><ul><li>Undocumented </li></ul></ul><ul><ul><li>Looks inactive </li></ul></ul><ul><ul><li>Lack of evidence </li></ul></ul><ul><li>Using Dojo + JSON </li></ul><ul><ul><li>Too complex </li></ul></ul><ul><li>YUI DataTable </li></ul><ul><ul><li>Buggy, beta </li></ul></ul><ul><li>Display tag library </li></ul>
    28. 29. Features ::Table sorting <ul><li>< display:table class= &quot;grid&quot; defaultsort= &quot;1&quot; id= “contact&quot; name= “contacts&quot; pagesize= &quot;5&quot; requestURI= &quot;phoneBook.acsp&quot; sort= &quot;list&quot; > </li></ul><ul><li>< display:column class= &quot;grid&quot; escapeXml= &quot;true&quot; headerClass= &quot;grid&quot; property= &quot;fullName&quot; title= &quot;Name&quot; sortable= &quot;true&quot; defaultorder= &quot;ascending&quot; /> </li></ul><ul><li>< display:column class= &quot;grid&quot; escapeXml= &quot;false&quot; headerClass= &quot;grid&quot; title= &quot;Email&quot; style= &quot; border-left : 1 px solid #5680AA ; &quot; > </li></ul><ul><li>< s:textfield value= &quot;%{#attr.contact.email}&quot; theme= &quot;simple&quot;/> </li></ul><ul><li></ display:column > </li></ul><ul><li></ display:table > </li></ul>From demo application phoneBook.jsp
    29. 30. Features :: Pagination <ul><li>Used the display tag library internal pagination support </li></ul><ul><ul><li>Supports internal and external pagination </li></ul></ul><ul><ul><li>Forces you to use HTTP GET </li></ul></ul><ul><ul><li>Adds pagination parameter to request </li></ul></ul>
    30. 31. Features ::Validation <ul><li>Uses 12 out-of-box field validators </li></ul><ul><li>Uses expression validators for complex validations </li></ul><ul><li>Validators can be declared using xml </li></ul><ul><li>Validators can be declared using annotations </li></ul><ul><ul><li>Field validators for setter methods </li></ul></ul><ul><ul><li>Expression validator for action methods </li></ul></ul>
    31. 32. Features ::Validation <ul><li>Annotation vs. xml example </li></ul><ul><li>(No annotated version for Struts1) </li></ul>@EmailValidator( fieldName = &quot;email&quot; , key= &quot;wrongEmailFormat&quot; , message= &quot;Wrong Email Format&quot; ) public void setEmail(String email) { this . email = email; } PhoneBook.java < validators> < field name= &quot;email&quot; > < field-validator type= &quot;email&quot; > < message key= &quot;wrongEmailFormat&quot; > Wrong Email Format </ message > </ field-validator > </ field > </ validators> PhoneBook_validation.xml
    32. 33. Features ::Client side validation <ul><li>Automatic creation of client side validation </li></ul><ul><ul><li>No client side for expression validators </li></ul></ul><ul><ul><li>Apply a theme for generating error feedback markup </li></ul></ul>< s:actionerror cssClass= &quot;feedback&quot; /> < s:form action= &quot;login&quot; namespace= &quot;/&quot; validate= &quot;true&quot; > < s:textfield cssClass= &quot;loginField&quot; size= &quot;25&quot; key= &quot;username&quot; /> < s:password cssClass= &quot;loginField&quot; size= &quot;25&quot; key= &quot;password&quot; /> < s:submit value= &quot;Login&quot; cssClass= &quot;button&quot; align= &quot;center&quot; /> </ s:form > login.jsp
    33. 34. Features ::Ajax <ul><li>Dojo is embedded for Ajax tags </li></ul><ul><li>Dojo head tag enables JS debugging </li></ul><ul><li>Ajax requests are handled by actions </li></ul><ul><li>DWR integration is enabled via plugin </li></ul><ul><li>YUI integration is enabled via plugin </li></ul><ul><li>Ajax file upload via plugin </li></ul><ul><li>Ajax behaviour for component tags </li></ul>
    34. 35. Features :: Ajax autocompleter <ul><li>View </li></ul>Action < s:url id= &quot;acUrl&quot; action= &quot;getDepts&quot; /> < s:autocompleter name= &quot;dept&quot; href= &quot;%{acUrl}&quot; cssClass= &quot;acSearchField&quot; /> private List<String> deptList; public String execute() { deptList = service. findAllDepartments(); return ActionSupport. SUCCESS; } public List<String> getDeptList() { return deptList; } phoneBook.jsp PhoneBook.java < action name= &quot;getDepts&quot; class= &quot;DeptsAutoComplete&quot; > < result type= &quot;json&quot; > < param name= &quot;root&quot; > deptList </ param > </ result > </ action > struts-default.xml
    35. 36. Features ::Error handling <ul><li>Validation error feedback tags </li></ul><ul><ul><li>actionerror </li></ul></ul><ul><ul><li>actionmessage </li></ul></ul><ul><ul><li>fielderror: per form field </li></ul></ul><ul><li>Two framework supporting interfaces </li></ul><ul><ul><li>Validatable: for programmatic validation </li></ul></ul><ul><ul><li>ValidationAware: for UI feedback </li></ul></ul>
    36. 37. Features ::Error handling <ul><li>Exception interceptor </li></ul><ul><ul><li>maps exceptions to result error pages </li></ul></ul><ul><ul><li>should be first in interceptor stack </li></ul></ul><!-- Fallback error page: --> < global-results > < result name= &quot;sysError&quot; >/pages/systemError.jsp</ result > </ global-results > < global-exception-mappings > < exception-mapping exception= &quot;java.lang.Exception&quot; result= &quot;sysError&quot; /> </ global-exception-mappings > struts.xml
    37. 38. Features ::I18N support <ul><li>Built on top of Java I18N support </li></ul><ul><li>Bundles can be defined in: </li></ul><ul><ul><li>action.properties </li></ul></ul><ul><ul><li>package.properties </li></ul></ul><ul><ul><li>global resource properties </li></ul></ul><ul><li>Bundles pushed to ValueStack </li></ul><ul><li>Validation errors can be localized </li></ul><ul><li>Locale interceptor to switch locale </li></ul>
    38. 39. Features ::Documentation <ul><li>Apache Struts 2 Documentation </li></ul><ul><li>WIKI </li></ul><ul><li>Struts Showcase </li></ul><ul><li>Plugins </li></ul>
    39. 40. Agenda <ul><li>Introduction </li></ul><ul><li>Background </li></ul><ul><li>Framework features review </li></ul><ul><ul><li>Configuration </li></ul></ul><ul><ul><li>View technology </li></ul></ul><ul><ul><li>Page flow </li></ul></ul><ul><ul><li>Form binding </li></ul></ul><ul><ul><li>Table sorting </li></ul></ul><ul><ul><li>Pagination </li></ul></ul><ul><ul><li>Validation </li></ul></ul><ul><ul><li>AJAX </li></ul></ul><ul><ul><li>Error handling </li></ul></ul><ul><ul><li>I18n support </li></ul></ul><ul><ul><li>Documentation </li></ul></ul><ul><li>Summary </li></ul>
    40. 41. Summary::Pros <ul><li>Extensible plugin framework </li></ul><ul><li>Modular and clean architecture </li></ul><ul><li>Annotation or xml configuration </li></ul><ul><li>Customized lifecycle via interceptors </li></ul><ul><li>Neat form & view binding </li></ul><ul><li>Easy client side validation </li></ul><ul><li>Markup generation with themes </li></ul>
    41. 42. Summary::Pros <ul><li>Fast learning curve </li></ul><ul><li>Intuitive </li></ul><ul><li>Restful URL action mapper </li></ul><ul><li>Easy to test (POJOs) using plugins </li></ul><ul><li>DI via lightweight containers </li></ul><ul><li>Decoration with tiles, sitemash </li></ul>
    42. 43. Summary::Cons <ul><li>Unorganized documentation </li></ul><ul><li>Lack of API documentation </li></ul><ul><li>No clear roadmap </li></ul><ul><li>ActionSupport dependency </li></ul><ul><li>Lack of @Action </li></ul><ul><li>Lack of @Interceptor </li></ul><ul><li>Cases when fallback to Servlet API is needed </li></ul><ul><li>Weakly typed sessions </li></ul>
    43. 44. Summary::When to use <ul><li>Use when </li></ul><ul><ul><li>Migrating from legacy framework </li></ul></ul><ul><ul><li>Natural around HTTP request response paradigm </li></ul></ul><ul><ul><li>Suitable for streaming </li></ul></ul><ul><ul><li>POC, prototype, RAD </li></ul></ul><ul><li>Don’t use when </li></ul><ul><ul><li>Heavily utilized RIA is needed </li></ul></ul><ul><ul><li>Your developers have Swing orientation </li></ul></ul>
    44. 45. <ul><li>Thank </li></ul><ul><li>You ! </li></ul>
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×