Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction into Struts2 jQuery Grid Tags

29,262 views

Published on

A short Introduction into Struts2 jQuery Grid Tags.

Published in: Technology
  • Be the first to comment

Introduction into Struts2 jQuery Grid Tags

  1. 1. Introduction into Struts2 jQuery Grid Tags <ul>2011 by Johannes Geppert (http://www.jgeppert.com) </ul>
  2. 2. Dependencies <ul><li>Struts2 Core and Dependencies
  3. 3. Struts2 JSON Plugin
  4. 4. Struts2 jQuery Plugin
  5. 5. Struts2 jQuery Grid Plugin </li></ul>
  6. 6. Architecture
  7. 7. Grid Action <ul><li>A simple Action that redirect to the grid.jsp </li></ul><struts> <package name=&quot;gridexample&quot; namespace=&quot;/&quot; extends=&quot;struts-default,json-default&quot;> <action name=&quot;grid&quot; class=&quot;com.jgeppert.grid.example.Grid&quot;> <result>/pages/grid.jsp</result> </action> </package> </struts> package com.jgeppert.grid.example; @ParentPackage(value = &quot;gridexample&quot;) public class GridAction extends ActionSupport { @Action(value = &quot;/grid&quot;, results = { @Result(location = &quot;/pages/grid.jsp&quot;, name = &quot;success&quot;) }) public String execute() throws Exception { .. } } XML Configuration Annotation based Configuration
  8. 8. Configure your Grid in grid.jsp <ul><li>Which Grid caption?
  9. 9. Do you need a Pager or Navigator?
  10. 10. How many Rows should be displayed?
  11. 11. How is the URL to your JSON Action and which is the Name of your gridModel Attribute? </li></ul><sjg:grid id=&quot;customerstable&quot; caption=&quot;Customers (Editable/Multiselect)&quot; pager=&quot;true&quot; navigator=&quot;true&quot; gridModel=&quot;gridModel&quot; rowList=&quot;10,15,20&quot; rowNum=&quot;15&quot; editurl=&quot;%{editurl}&quot; multiselect=&quot;true&quot; viewrecords=&quot;true&quot; > <sjg:gridColumn … /> </sjg:grid>
  12. 12. Configure your Grid Columns in grid.jsp <ul><li>Is Column editable?
  13. 13. Are there Edit Rules?
  14. 14. Is Column searchable or sortable?
  15. 15. Which formatter (date, currency, custum, …) </li></ul><sjg:gridColumn name=&quot;creditlimit&quot; index=&quot;creditlimit&quot; title=&quot;Credit Limit&quot; align=&quot;right&quot; editable=&quot;true&quot; editrules=&quot;{ number: true, required: true, minValue : 100.0, maxValue : 1000000.0 }&quot; formatter=&quot;currency&quot; sortable=&quot;true&quot; search=&quot;true&quot; searchoptions=&quot;{sopt:['eq','ne','lt','gt']}&quot; />
  16. 16. JSON Action <ul><li>The JSON Action is your data provider
  17. 17. Implement Logic for sorting and search data here </li></ul><struts> <package name=&quot;gridexample&quot; namespace=&quot;/&quot; extends=&quot;struts-default,json-default&quot;> <action name=&quot;grid&quot; class=&quot;com.jgeppert.grid.example.Grid&quot;> <result>/pages/grid.jsp</result> </action> <action name=&quot;json-table&quot; class=&quot;com.jgeppert.grid.example. JsonTable &quot;> <result name=”success” type=”json” /> </action> </package> </struts> package com.jgeppert.grid.example; @ParentPackage(value = &quot;gridexample&quot;) @Result(type = &quot;json&quot;) public class JsonTable extends ActionSupport { private List<Customers> gridModel; public String getJSON() { return execute(); } public String execute() throws Exception { gridModel = customersDao.find() } public List<Customers> getGridModel() { return gridModel; } } XML Configuration Annotation based Configuration
  18. 18. Resources <ul><li>Google (struts2 jquery grid) http://www.google.de/search?q=struts2+jquery+grid
  19. 19. Struts2 jQuery Project https://code.google.com/p/struts2-jquery/
  20. 20. Wiki http://code.google.com/p/struts2-jquery/wiki/GridTag
  21. 21. Struts2 jQuery Showcase http://www.weinfreund.de/struts2-jquery-showcase/index.action
  22. 22. Struts2 jQuery Grid Showcase
  23. 23. http://www.weinfreund.de/struts2-jquery-grid-showcase/index.action
  24. 24. Problems and Questions -> User Group http://groups.google.com/group/struts2-jquery/
  25. 25. Bugs and Issues https://code.google.com/p/struts2-jquery/issues/list </li></ul>

×