{"id":1402,"date":"2012-06-13T01:00:00","date_gmt":"2012-06-13T01:00:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/query-grid-with-struts-2-without-plugin.html"},"modified":"2012-10-22T05:38:05","modified_gmt":"2012-10-22T05:38:05","slug":"query-grid-with-struts-2-without-plugin","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html","title":{"rendered":"Query grid with struts 2 without plugin"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\">When using jQuery with struts 2, the developers are persuaded to use                      <a href=\"https:\/\/cwiki.apache.org\/S2PLUGINS\/2012\/03\/14\/struts2-jquery-plugin-version-330.html\">struts2-jQuery plug-in<\/a>. Because most of the forums and other Internet resources support struts2 jQuery plug in. I have this experience. I wanted to use jQuery grid plug-in with struts 2,but without using struts2 jQuery plug-in. It was very hard for me to find a tutorial or any good resource to implement struts 2 action class to create the                      <a href=\"http:\/\/www.trirand.com\/blog\/jqgrid\/jqgrid.html\">jQuery grid<\/a> without using struts2 jQuery plug-in. Finally, I got through this by myself and intended to post for your convenience.<\/p>\n<p>This tutorial explains, How to create jQuery grid with struts2 without using the plug-in. I filtered this code out from my existing project. The architecture of the project is based on strts2, spring and hibernate integrated environment. I am sure, You can customise these code so that it suits to your environment.<br \/>\n<strong>Step 01:<\/strong>                     <i>Creating entity class for &#8216;<strong>Province<\/strong>&#8216; master screen.<\/i>                                        <\/p>\n<p>I use JPA as a persistence technology and hibernate data access support given by spring (                     <strong>HibernateDaoSupport<\/strong>). I am not going to explain these stuff in detail. My major concern is, How to create the struts 2 action class that supports jQuery grid. Here is my entity class.                                         <\/p>\n<p><strong>Province.java<\/strong><\/p>\n<pre class=\"brush:java\">\/**\r\n * \r\n *\/\r\npackage com.shims.model.maintenance;\r\n\r\nimport java.io.Serializable;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\nimport javax.persistence.CascadeType;\r\nimport javax.persistence.Column;\r\nimport javax.persistence.Entity;\r\nimport javax.persistence.FetchType;\r\nimport javax.persistence.GeneratedValue;\r\nimport javax.persistence.GenerationType;\r\nimport javax.persistence.Id;\r\nimport javax.persistence.OneToMany;\r\nimport javax.persistence.SequenceGenerator;\r\nimport javax.persistence.Table;\r\n\r\nimport org.hibernate.annotations.Cascade;\r\n\r\nimport com.shims.model.Audited;\r\n\r\n\/**\r\n * @author Semika Siriwardana\r\n *\r\n *\/\r\n @Entity\r\n @Table(name='PROVINCE') \r\n public class Province extends Audited implements Serializable {\r\n\r\n private static final long serialVersionUID = -6842726343310595087L;\r\n \r\n @Id\r\n @SequenceGenerator(name='province_seq', sequenceName='province_seq')\r\n @GeneratedValue(strategy = GenerationType.AUTO, generator = 'province_seq')\r\n private Long id;\r\n \r\n @Column(name='description', nullable = false)\r\n private String name;\r\n \r\n @Column(name='status', nullable = false)\r\n private char status;\r\n \r\n \/**\r\n  * \r\n  *\/\r\n public Province() {\r\n      super();\r\n }\r\n\r\n \/**\r\n  * @param id\r\n  *\/\r\n public Province(Long id) {\r\n      super();\r\n      this.id = id;\r\n }\r\n\r\n \/**\r\n  * @return the id\r\n  *\/\r\n public Long getId() {\r\n      return id;\r\n }\r\n\r\n \/**\r\n  * @param id the id to set\r\n  *\/\r\n public void setId(Long id) {\r\n      this.id = id;\r\n }\r\n\r\n \/**\r\n  * @return the name\r\n  *\/\r\n public String getName() {\r\n      return name;\r\n }\r\n\r\n \/**\r\n  * @param name the name to set\r\n  *\/\r\n public void setName(String name) {\r\n      this.name = name;\r\n }\r\n\r\n \/**\r\n  * @return the status\r\n  *\/\r\n public char getStatus() {\r\n      return status;\r\n }\r\n\r\n \/**\r\n  * @param status the status to set\r\n  *\/\r\n public void setStatus(char status) {\r\n      this.status = status;\r\n }\r\n}\r\n<\/pre>\n<p><strong>Step 02:                     <i>Creating JSP file for &#8216;Province&#8217; master screen grid<\/i>.                    <\/strong><\/p>\n<p>Keep in mind that jQuery grid is a plug-in for jQuery. So You need to download the relevant CSS file and JS file for the                     <a href=\"http:\/\/www.trirand.com\/blog\/?page_id=5\"> jQuery grid plug-in<\/a>. You may need to include following resources in the head part of the JSP file.                                         <\/p>\n<pre class=\"brush:java\">&lt;link type='text\/css' rel='stylesheet' media='screen' href='&lt;%=request.getContextPath()%&gt;\/css\/jquery\/themes\/redmond\/jquery-ui-1.8.16.custom.css'&gt;\r\n&lt;link type='text\/css' rel='stylesheet' media='screen' href='&lt;%=request.getContextPath()%&gt;\/css\/ui.jqgrid.css'&gt;\r\n&lt;script src='&lt;%=request.getContextPath()%&gt;\/js\/jquery-1.6.2.min.js' type='text\/javascript'&gt;&lt;\/script&gt;\r\n&lt;script src='&lt;%=request.getContextPath()%&gt;\/js\/grid.locale-en.js' type='text\/javascript'&gt;&lt;\/script&gt;\r\n&lt;script src='&lt;%=request.getContextPath()%&gt;\/js\/jquery.jqGrid.src.js' type='text\/javascript'&gt;&lt;\/script&gt;\r\n&lt;script src='&lt;%=request.getContextPath()%&gt;\/js\/jquery-ui-1.8.16.custom.min.js' type='text\/javascript'&gt;&lt;\/script&gt;<\/pre>\n<p>Then, We will create the required DOM contents in JSP file to render the grid. For this, You need only a simple TABLE and DIV elements placed with in the JSP file with the given ID&#8217;s as follows.                                         <\/p>\n<pre class=\"brush:java\">&lt;table id='list'&gt;&lt;\/table&gt; \r\n&lt;div id='pager'&gt;&lt;\/div&gt;<\/pre>\n<p>The &#8216;                    <strong>pager<\/strong>&#8216; DIV tag is needed to render the pagination bar of the jQuery grid.                    <\/p>\n<p><strong>Step 03:                     <i>Creating JS file for &#8216;Province&#8217; master screen grid. <\/i>                   <\/strong><\/p>\n<p>jQuery grid is needed to be initiated with javascript. I am going to initiate the grid with page on load. There are so many functionalities like adding new records, updating records, deleting records, searching supported by jQuery grid. I guess, You can familiar with those stuff, If You can create the initial grid. This javascript contains only the code that initiating the grid.                                         <\/p>\n<pre class=\"brush:java\">var SHIMS = {}\r\nvar SHIMS.Province = {\r\n \r\n onRowSelect: function(id) {\r\n      \/\/Handle event\r\n },\r\n \r\n onLoadComplete: function() {\r\n      \/\/Handle grid load complete event.\r\n },\r\n\r\n onLoadError: function() {\r\n      \/\/Handle when data loading into grid failed. \r\n },\r\n\r\n \/**\r\n  * Initialize grid\r\n  *\/\r\n initGrid: function(){\r\n  \r\n  jQuery('#list').jqGrid({ \r\n         url:CONTEXT_ROOT + '\/secure\/maintenance\/province!search.action', \r\n         id:'gridtable', \r\n         caption:'SHIMS:Province Maintenance',\r\n         datatype: 'json', \r\n         pager: '#pager', \r\n         colNames:['Id','Name','Status'], \r\n         pagerButtons:true,\r\n         navigator:true,\r\n         jsonReader : {\r\n                      root: 'gridModel', \r\n                      page: 'page',\r\n                      total: 'total',\r\n                      records: 'records',\r\n                      repeatitems: false,      \r\n                      id: '0'      \r\n         }, \r\n         colModel:[ {\r\n                     name:'id',\r\n                     index:'id', \r\n                     width:200, \r\n                     sortable:true, \r\n                     editable:false, \r\n                     search:true\r\n                    },{\r\n                     name:'name',\r\n                     index:'name', \r\n                     width:280, \r\n                     sortable:true, \r\n                     editable:true, \r\n                     search:true, \r\n                     formoptions:{elmprefix:'(*)'},\r\n                     editrules :{required:true}\r\n                    },{\r\n                     name:'provinceStatus',\r\n                     index:'provinceStatus', \r\n                     width:200, \r\n                     sortable:false, \r\n                     editable:true, \r\n                     search:false, \r\n                     editrules:{required:true}, \r\n                     edittype:'select', \r\n                     editoptions:{value:'A:A;D:D'}\r\n                 }], \r\n         rowNum:30, \r\n         rowList:[10,20,30], \r\n         width:680,\r\n         rownumbers:true,\r\n         viewrecords:true, \r\n         sortname: 'id', \r\n         viewrecords: true, \r\n         sortorder: 'desc', \r\n         onSelectRow:SHIMS.Province.onRowSelect, \r\n         loadComplete:SHIMS.Province.onLoadComplete,\r\n         loadError:SHIMS.Province.onLoadError,\r\n         editurl:CONTEXT_ROOT + '\/secure\/maintenance\/province!edit.action' \r\n         });\r\n },\r\n \r\n \/**\r\n  * Invoke this method with page on load.\r\n  *\/\r\n        \r\n onLoad: function() {\r\n     this.initGrid();\r\n }\r\n};<\/pre>\n<p>I wish to highlight some code snips from the above code. The &#8216;                     <strong>jsonReader<\/strong>&#8216; attribute of the grid initialisation object was the key point where it was difficult to find and spent plenty of times to make the grid work.<br \/>\n<strong>root<\/strong> &#8211; This should be list of objects.<br \/>\n<strong>page<\/strong> &#8211; Current page number.<br \/>\n<strong>total<\/strong> &#8211; This is the total number of pages. For example, if You have 1000 records and the page size is 10, the &#8216;total&#8217; value will be 100.                    <div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><strong>records<\/strong> &#8211; The total number of records or count of records.                    <\/p>\n<p>If You are creating grid with JSON data, the response of the specified &#8216;                     <strong>url<\/strong>&#8216; should be JSON response in this format. Sample JSON response is shown bellow.                                         <\/p>\n<pre class=\"brush:java\">{'gridModel':[\r\n          {'id':15001,'name':'Western','provinceStatus':'A'},\r\n          {'id':14001,'name':'North','provinceStatus':'A'},\r\n          {'id':13001,'name':'North Central','provinceStatus':'A'},\r\n          {'id':12002,'name':'East','provinceStatus':'A'},\r\n          {'id':12001,'name':'Southern','provinceStatus':'A'}\r\n             ],\r\n'page':1,\r\n'records':11,\r\n'rows':30,\r\n'sidx':'id',\r\n'sord':'desc',\r\n'total':2}<\/pre>\n<p>Above fields should be declared in the action class and updated appropriately. I will come to that later. If You intend to use operations like add record, delete record, update record, search etc, You must specify &#8216;                     <strong>editurl<\/strong>&#8216;.                                         <\/p>\n<p>With in the JSP file, just above the close body tag, I have placed the following script to call the grid initialisation code.<\/p>\n<pre class=\"brush:java\"> var CONTEXT_ROOT = '&lt;%=request.getContextPath()%&gt;';\r\n jQuery(document).ready(function(){\r\n      SHIMS.Province.onLoad();\r\n }); <\/pre>\n<p><strong>Step 04:                     <i>Creating Struts2 action class for &#8216;Province&#8217; master screen grid. <\/i>                   <\/strong><\/p>\n<p>This is the most important part of this tutorial.                    <\/p>\n<p><strong>ProvinceAction.java <\/strong>                   <\/p>\n<pre class=\"brush:java\">\/**\r\n * \r\n *\/\r\npackage com.shims.web.actions.maintenance.province;\r\n\r\nimport java.util.List;\r\n\r\nimport org.apache.log4j.Logger;\r\nimport org.apache.struts2.convention.annotation.Namespace;\r\nimport org.apache.struts2.convention.annotation.ParentPackage;\r\nimport org.apache.struts2.convention.annotation.Result;\r\nimport org.apache.struts2.convention.annotation.Results;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Controller;\r\n\r\nimport com.opensymphony.xwork2.ModelDriven;\r\nimport com.shims.dto.Page;\r\nimport com.shims.dto.ProvinceDto;\r\nimport com.shims.model.maintenance.Province;\r\nimport com.shims.service.maintenance.api.ProvinceService;\r\nimport com.shims.support.SHIMSSoringSupport;\r\nimport com.shims.web.actions.common.BaseAction;\r\nimport com.shims.web.common.WebConstants;\r\n\r\n\/**\r\n * @author Semika Siriwardana\r\n *\r\n *\/\r\n @Controller\r\n @Namespace(WebConstants.MAINTENANCE_NAMESPACE) \r\n @ParentPackage(WebConstants.MAINTENANCE_PACKAGE)\r\n @Results({@Result(name=ProvinceAction.SUCCESS, location='\/jsp\/maintenance\/province.jsp'), \r\n       @Result(name = 'json', type = 'json')}) \r\n public class ProvinceAction extends BaseAction&lt;Province&gt; implements ModelDriven&lt;Province&gt; {\r\n\r\n private static final long serialVersionUID = -3007855590220260696L;\r\n\r\n private static Logger logger = Logger.getLogger(ProvinceAction.class);\r\n \r\n @Autowired\r\n private ProvinceService provinceService;\r\n \r\n private List&lt;Province&gt; gridModel = null;\r\n \r\n private Province model = new Province();\r\n \r\n private Integer rows = 0;\r\n private Integer page = 0;\r\n private String sord;\r\n private String sidx;\r\n private Integer total = 0;\r\n private Integer records = 0;\r\n \r\n @Override\r\n public String execute() {\r\n      return SUCCESS;\r\n }\r\n \r\n \/**\r\n  * Search provinces\r\n  * @return\r\n  *\/\r\n public String search() throws Exception {\r\n  \r\n      Page&lt;Province&gt; resultPage = provinceService.findByCriteria(model, getRequestedPage(page));\r\n      List&lt;Province&gt; provinceList = resultPage.getResultList(); \r\n      setGridModel(provinceList); \r\n      setRecords(resultPage.getRecords());\r\n      setTotal(resultPage.getTotals());\r\n   \r\n      return JSON;\r\n }\r\n\r\n \/**\r\n  * @return the gridModel\r\n  *\/\r\n public List&lt;Province&gt; getGridModel() {\r\n      return gridModel;\r\n }\r\n\r\n \/**\r\n  * @param gridModel the gridModel to set\r\n  *\/\r\n public void setGridModel(List&lt;Province&gt; gridModel) {\r\n      this.gridModel = gridModel;\r\n }\r\n\r\n \/**\r\n  * @return the page\r\n  *\/\r\n public Integer getPage() {\r\n      return page;\r\n }\r\n\r\n \/**\r\n  * @param page the page to set\r\n  *\/\r\n public void setPage(Integer page) {\r\n      this.page = page;\r\n }\r\n\r\n \/**\r\n  * @return the rows\r\n  *\/\r\n public Integer getRows() {\r\n      return rows;\r\n }\r\n\r\n \/**\r\n  * @param rows the rows to set\r\n  *\/\r\n public void setRows(Integer rows) {\r\n      this.rows = rows;\r\n }\r\n\r\n \/**\r\n  * @return the sidx\r\n  *\/\r\n public String getSidx() {\r\n      return sidx;\r\n }\r\n\r\n \/**\r\n  * @param sidx the sidx to set\r\n  *\/\r\n public void setSidx(String sidx) {\r\n      this.sidx = sidx;\r\n }\r\n\r\n \/**\r\n  * @return the sord\r\n  *\/\r\n public String getSord() {\r\n      return sord;\r\n }\r\n\r\n \/**\r\n  * @param sord the sord to set\r\n  *\/\r\n public void setSord(String sord) {\r\n      this.sord = sord;\r\n }\r\n\r\n \/**\r\n  * @return the total\r\n  *\/\r\n public Integer getTotal() {\r\n      return total;\r\n }\r\n\r\n \/**\r\n  * @param total the total to set\r\n  *\/\r\n public void setTotal(Integer total) {\r\n      this.total = total;\r\n }\r\n\r\n \/**\r\n  * @return the records\r\n  *\/\r\n public Integer getRecords() {\r\n      return records;\r\n }\r\n\r\n \/**\r\n  * @param records the records to set\r\n  *\/\r\n public void setRecords(Integer records) {\r\n      this.records = records;\r\n }\r\n\r\n @Override\r\n public Province getModel() {\r\n      return model;\r\n }\r\n \r\n}<\/pre>\n<p>The getRequestedPage() method is a generic method implemented with in the &#8216;BaseAction&#8217; class which returns a &#8216;Page&#8217; instance for a given type.                                                                <\/p>\n<p><strong>BaseAction.java<\/strong>                                                              <\/p>\n<pre class=\"brush:java\">\/**\r\n * \r\n *\/\r\npackage com.shims.web.actions.common;\r\n\r\nimport java.util.Map;\r\n\r\nimport javax.servlet.http.HttpServletRequest;\r\n\r\nimport org.apache.struts2.interceptor.ServletRequestAware;\r\nimport org.apache.struts2.interceptor.SessionAware;\r\n\r\nimport com.opensymphony.xwork2.ActionSupport;\r\nimport com.shims.dto.Page;\r\nimport com.shims.dto.security.UserDto;\r\nimport com.shims.web.common.WebConstants;\r\n\r\nimport flexjson.JSONSerializer;\r\n\r\n\/**\r\n * @author Semika Siriwardana\r\n *\r\n *\/\r\n public abstract class BaseAction&lt;T&gt; extends ActionSupport implements ServletRequestAware, SessionAware {\r\n\r\n private static final long serialVersionUID = -8209196735097293008L;\r\n \r\n protected static final Integer PAGE_SIZE = 10;\r\n\r\n protected HttpServletRequest request;\r\n \r\n protected Map&lt;String, Object&gt; session; \r\n \r\n protected String JSON = 'json';\r\n \r\n public abstract String execute(); \r\n \r\n public HttpServletRequest getRequest() {\r\n      return request;\r\n }\r\n\r\n @Override\r\n public void setServletRequest(HttpServletRequest request) {\r\n      this.request = request;\r\n }\r\n\r\n protected void setRequestAttribute(String key, Object obj) {\r\n      request.setAttribute(key, obj);\r\n }\r\n \r\n \/**\r\n  * Returns generic Page instance.\r\n  * @param domain\r\n  * @param employeeDto\r\n  * @return\r\n  *\/\r\n protected Page&lt;T&gt; getRequestedPage(Integer page){\r\n      Page&lt;T&gt; requestedPage = new Page&lt;T&gt;(); \r\n      requestedPage.setPage(page);\r\n      requestedPage.setRows(PAGE_SIZE);\r\n      return requestedPage;\r\n }\r\n \r\n \/**\r\n  * @return the session\r\n  *\/\r\n public Map&lt;String, Object&gt; getSession() { \r\n      return session;\r\n }\r\n\r\n \/**\r\n  * @param session the session to set\r\n  *\/\r\n public void setSession(Map&lt;String, Object&gt; session) { \r\n      this.session = session;\r\n }\r\n \r\n}<\/pre>\n<p>I already explained &#8216;                     <strong>gridModel<\/strong>&#8216;, &#8216;                     <strong>page<\/strong>&#8216;, &#8216;                     <strong>total<\/strong>&#8216; and                      <strong>&#8216;records<\/strong>&#8216;. &#8216;                     <strong>sord<\/strong>&#8216; and &#8216;                     <strong>sidx<\/strong>&#8216; which are referenced as &#8216;sorting order&#8217; and &#8216;sorting index&#8217;, are passed by the jQuery grid when We sort the data in the grid with some column. To fetch those tow fields, We should declare it with in the action class and provide setter and getter methods. Later, We can sort our data list based on those tow parameters.                                         <\/p>\n<p><strong>Step 05:                     <i>Implementing service methods. <\/i>                   <\/strong><\/p>\n<p>From here onwards, most of the techniques are specific to my current project framework. I will explain those so that You can understand, How I developed the related service and DAO methods.                                                               Since, jQuery grid supports for paging, It was need to have a proper way of exchanging grid information from front-end to back-end and then back-end to front-end. I implemented generic &#8216;Page&#8217; class for this purpose.                                         <\/p>\n<pre class=\"brush:java\">\/**\r\n * \r\n *\/\r\npackage com.shims.dto;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n\/**\r\n * @author semikas\r\n *\r\n *\/\r\n public class Page&lt;T&gt; {\r\n\r\n \/**\r\n  * Query result list.\r\n  *\/\r\n private List&lt;T&gt; resultList = new ArrayList&lt;T&gt;(); \r\n \r\n \/**\r\n  * Requested page number.\r\n  *\/\r\n private Integer page = 1;\r\n \r\n \/**\r\n  * Number of rows displayed in a single page.\r\n  *\/\r\n private Integer rows = 10;\r\n \r\n \/**\r\n  * Total number of records return from the query.\r\n  *\/\r\n private Integer records;\r\n \r\n \/**\r\n  * Total number of pages.\r\n  *\/\r\n private Integer totals;\r\n\r\n \/**\r\n  * @return the resultDtoList\r\n  *\/\r\n public List&lt;T&gt; getResultList() {\r\n      return resultList;\r\n }\r\n\r\n \/**\r\n  * @param resultDtoList the resultDtoList to set\r\n  *\/\r\n public void setResultList(List&lt;T&gt; resultList) {\r\n      this.resultList = resultList;\r\n }\r\n\r\n \/**\r\n  * @return the page\r\n  *\/\r\n public Integer getPage() {\r\n      return page;\r\n }\r\n\r\n \/**\r\n  * @param page the page to set\r\n  *\/\r\n public void setPage(Integer page) {\r\n      this.page = page;\r\n }\r\n\r\n \/**\r\n  * @return the rows\r\n  *\/\r\n public Integer getRows() {\r\n      return rows;\r\n }\r\n\r\n \/**\r\n  * @param rows the rows to set\r\n  *\/\r\n public void setRows(Integer rows) {\r\n      this.rows = rows;\r\n }\r\n\r\n \/**\r\n  * @return the records\r\n  *\/\r\n public Integer getRecords() {\r\n      return records;\r\n }\r\n\r\n \/**\r\n  * @param records the records to set\r\n  *\/\r\n public void setRecords(Integer records) {\r\n      this.records = records;\r\n }\r\n\r\n \/**\r\n  * @return the totals\r\n  *\/\r\n public Integer getTotals() {\r\n      return totals;\r\n }\r\n\r\n \/**\r\n  * @param totals the totals to set\r\n  *\/\r\n public void setTotals(Integer totals) {\r\n      this.totals = totals;\r\n }\r\n \r\n}<\/pre>\n<p>Also, with some search criteria, We can fetch the data and update the grid accordingly.<br \/>\nMy service interface and implementation classes are as follows.                    <\/p>\n<p><strong>ProvinceService.java <\/strong>                   <\/p>\n<pre class=\"brush:java\">\/**\r\n * \r\n *\/\r\npackage com.shims.service.maintenance.api;\r\n\r\nimport java.util.List;\r\n\r\nimport com.shims.dto.Page;\r\nimport com.shims.exceptions.ServiceException;\r\nimport com.shims.model.maintenance.Province;\r\n\r\n\/**\r\n * @author Semika Siriwardana\r\n *\r\n *\/\r\npublic interface ProvinceService {\r\n\r\n \/**\r\n  * Returns list of provinces for a given search criteria.\r\n  * @return\r\n  * @throws ServiceException\r\n  *\/\r\n  public Page&lt;Province&gt; findByCriteria(Province searchCriteria, Page&lt;Province&gt; page) throws ServiceException;\r\n \r\n}\r\n<\/pre>\n<p><strong>ProvinceServiceImpl.java <\/strong>                   <\/p>\n<pre class=\"brush:java\">\/**\r\n * \r\n *\/\r\npackage com.shims.service.maintenance.impl;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Service;\r\n\r\nimport com.shims.dto.Page;\r\nimport com.shims.exceptions.ServiceException;\r\nimport com.shims.model.maintenance.Province;\r\nimport com.shims.persist.maintenance.api.ProvinceDao;\r\nimport com.shims.service.maintenance.api.ProvinceService;\r\n\r\n\r\n\/**\r\n * @author Semika Siriwardana\r\n *\r\n *\/\r\n @Service\r\n public class ProvinceServiceImpl implements ProvinceService {\r\n\r\n @Autowired\r\n private ProvinceDao provinceDao; \r\n \r\n \/**\r\n  * {@inheritDoc} \r\n  *\/\r\n @Override\r\n public Page&lt;Province&gt; findByCriteria(Province searchCriteria, Page&lt;Province&gt; page) throws ServiceException {\r\n  \r\n      Page&lt;Province&gt; resultPage = provinceDao.findByCriteria(searchCriteria, page); \r\n  \r\n      return resultPage;\r\n }\r\n\r\n}<\/pre>\n<p>I am using &#8216;                    <strong>page<\/strong>&#8216; instance to exchange the grid information in between front end and back end.                    <\/p>\n<p>Next, I will explain the other important part of this tutorial.                    <\/p>\n<p><strong>Step 06:<\/strong>                     <i>Implementing data access method. <\/i>                   <\/p>\n<p>In the DAO method, We should filtered only the records of the requested page by the user and also should be updated the &#8216;                     <strong>page<\/strong>&#8216; instance attributes so that those should be reflected to the grid. Since, I am using hibernated, I used &#8216;Criteria&#8217; to retrieve the required data from the database. You implement this in your way, But it should update the grid information properly.                                         <\/p>\n<p><strong>ProvinceDao.java <\/strong>                   <\/p>\n<pre class=\"brush:java\">\/**\r\n * \r\n *\/\r\npackage com.shims.persist.maintenance.api;\r\n\r\nimport com.shims.dto.Page;\r\nimport com.shims.exceptions.DataAccessException;\r\nimport com.shims.model.maintenance.Province;\r\nimport com.shims.persist.common.GenericDAO;\r\n\r\n\/**\r\n * @author Semika Siriwardana\r\n *\r\n *\/\r\npublic interface ProvinceDao extends GenericDAO&lt;Province, Long&gt; { \r\n\r\n \/**\r\n  * Returns search results for a given search criteria.\r\n  * @param searchCriteria\r\n  * @param page\r\n  * @return\r\n  * @throws DataAccessException\r\n  *\/\r\n  public Page&lt;Province&gt; findByCriteria(Province searchCriteria, Page&lt;Province&gt; page) throws DataAccessException;\r\n \r\n}\r\n<\/pre>\n<p><strong>ProvinceDaoImpl.java<\/strong>                   <\/p>\n<pre class=\"brush:java\">\/**\r\n * \r\n *\/\r\npackage com.shims.persist.maintenance.impl;\r\n\r\nimport java.util.List;\r\n\r\nimport org.hibernate.Criteria;\r\nimport org.hibernate.SessionFactory;\r\nimport org.hibernate.criterion.MatchMode;\r\nimport org.hibernate.criterion.Projections;\r\nimport org.hibernate.criterion.Restrictions;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Repository;\r\n\r\nimport com.shims.dto.Page;\r\nimport com.shims.exceptions.DataAccessException;\r\nimport com.shims.model.maintenance.Province;\r\nimport com.shims.persist.maintenance.api.ProvinceDao;\r\n\r\n\/**\r\n * @author Semika Siriwardana\r\n *\r\n *\/\r\n @Repository\r\n public class ProvinceDaoImpl extends AbstractMaintenanceDaoSupport&lt;Province, Long&gt; implements ProvinceDao {\r\n\r\n @Autowired\r\n public ProvinceDaoImpl(SessionFactory sessionFactory) {\r\n      setSessionFactory(sessionFactory);\r\n }\r\n\r\n \/**\r\n  * {@inheritDoc} \r\n  *\/\r\n @SuppressWarnings('unchecked')\r\n @Override\r\n public Page&lt;Province&gt; findByCriteria(ProvinceDto searchCriteria, Page&lt;Province&gt; page) throws SHIMSDataAccessException {\r\n  \r\n      Criteria criteria = getSession().createCriteria(Province.class);\r\n  \r\n      if (searchCriteria.getName() != null &amp;&amp; searchCriteria.getName().trim().length() != 0) {\r\n          criteria.add(Restrictions.ilike('name', searchCriteria.getName(), MatchMode.ANYWHERE)); \r\n   \r\n      }\r\n  \r\n      \/\/get total number of records first\r\n      criteria.setProjection(Projections.rowCount());\r\n      Integer rowCount = ((Integer)criteria.list().get(0)).intValue();\r\n  \r\n      \/\/reset projection to null\r\n      criteria.setProjection(null);\r\n  \r\n      Integer to = page.getPage() * page.getRows();\r\n      Integer from = to - page.getRows();\r\n  \r\n      criteria.setFirstResult(from);\r\n      criteria.setMaxResults(to); \r\n  \r\n      \/\/calculate the total pages for the query\r\n      Integer totNumOfPages =(int) Math.ceil((double)rowCount \/ (double)page.getRows());\r\n  \r\n      List&lt;Province&gt; privinces = (List&lt;Province&gt;)criteria.list(); \r\n  \r\n      \/\/Update 'page' instance.\r\n      page.setRecords(rowCount); \/\/Total number of records\r\n      page.setTotals(totNumOfPages); \/\/Total number of pages\r\n      page.setResultList(privinces);\r\n  \r\n      return page; \r\n }\r\n}\r\n<\/pre>\n<p>I think, This will be a good help for the developers who wish to use pure jQuery with struts2. If You find more related to this topic, please post bellow.<\/p>\n<p><strong><i>Reference: <\/i><\/strong><a href=\"http:\/\/semikas.blogspot.com\/2012\/04\/how-to-use-jquery-grid-with-struts-2.html\">How to use jQuery grid with struts 2 without plugin ?<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Semika loku kaluge at the <a href=\"http:\/\/semikas.blogspot.com\/\">Code Box<\/a> blog.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>When using jQuery with struts 2, the developers are persuaded to use struts2-jQuery plug-in. Because most of the forums and other Internet resources support struts2 jQuery plug in. I have this experience. I wanted to use jQuery grid plug-in with struts 2,but without using struts2 jQuery plug-in. It was very hard for me to find &hellip;<\/p>\n","protected":false},"author":227,"featured_media":81,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[543,209],"class_list":["post-1402","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-apache-struts","tag-jquery"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Query grid with struts 2 without plugin - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"When using jQuery with struts 2, the developers are persuaded to use struts2-jQuery plug-in. Because most of the forums and other Internet resources\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Query grid with struts 2 without plugin - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"When using jQuery with struts 2, the developers are persuaded to use struts2-jQuery plug-in. Because most of the forums and other Internet resources\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2012-06-13T01:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-10-22T05:38:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-struts-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Semika Kaluge\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Semika Kaluge\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/query-grid-with-struts-2-without-plugin.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/query-grid-with-struts-2-without-plugin.html\"},\"author\":{\"name\":\"Semika Kaluge\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/511aa57cb783e9e45ebbdfbaeea786e1\"},\"headline\":\"Query grid with struts 2 without plugin\",\"datePublished\":\"2012-06-13T01:00:00+00:00\",\"dateModified\":\"2012-10-22T05:38:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/query-grid-with-struts-2-without-plugin.html\"},\"wordCount\":924,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/query-grid-with-struts-2-without-plugin.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/apache-struts-logo.jpg\",\"keywords\":[\"Apache Struts\",\"jQuery\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/query-grid-with-struts-2-without-plugin.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/query-grid-with-struts-2-without-plugin.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/query-grid-with-struts-2-without-plugin.html\",\"name\":\"Query grid with struts 2 without plugin - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/query-grid-with-struts-2-without-plugin.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/query-grid-with-struts-2-without-plugin.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/apache-struts-logo.jpg\",\"datePublished\":\"2012-06-13T01:00:00+00:00\",\"dateModified\":\"2012-10-22T05:38:05+00:00\",\"description\":\"When using jQuery with struts 2, the developers are persuaded to use struts2-jQuery plug-in. Because most of the forums and other Internet resources\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/query-grid-with-struts-2-without-plugin.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/query-grid-with-struts-2-without-plugin.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/query-grid-with-struts-2-without-plugin.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/apache-struts-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/apache-struts-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/query-grid-with-struts-2-without-plugin.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Query grid with struts 2 without plugin\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/511aa57cb783e9e45ebbdfbaeea786e1\",\"name\":\"Semika Kaluge\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/19ddbcbcd7a71589e915a5fe88bc5478d414fb1a8b35504d927473cb74abf9a1?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/19ddbcbcd7a71589e915a5fe88bc5478d414fb1a8b35504d927473cb74abf9a1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/19ddbcbcd7a71589e915a5fe88bc5478d414fb1a8b35504d927473cb74abf9a1?s=96&d=mm&r=g\",\"caption\":\"Semika Kaluge\"},\"description\":\"I am working in software engineering field for six years of time by now. Currently, I am working for Shipxpress Inc in Sri Lanka. Primarily, I love to involve with Java developments and related frameworks like Spring, Struts, Hibernate and many more, specially interested in Javascript.\",\"sameAs\":[\"http:\\\/\\\/semikas.blogspot.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/semika-kaluge\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Query grid with struts 2 without plugin - Java Code Geeks","description":"When using jQuery with struts 2, the developers are persuaded to use struts2-jQuery plug-in. Because most of the forums and other Internet resources","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html","og_locale":"en_US","og_type":"article","og_title":"Query grid with struts 2 without plugin - Java Code Geeks","og_description":"When using jQuery with struts 2, the developers are persuaded to use struts2-jQuery plug-in. Because most of the forums and other Internet resources","og_url":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-06-13T01:00:00+00:00","article_modified_time":"2012-10-22T05:38:05+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-struts-logo.jpg","type":"image\/jpeg"}],"author":"Semika Kaluge","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Semika Kaluge","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html"},"author":{"name":"Semika Kaluge","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/511aa57cb783e9e45ebbdfbaeea786e1"},"headline":"Query grid with struts 2 without plugin","datePublished":"2012-06-13T01:00:00+00:00","dateModified":"2012-10-22T05:38:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html"},"wordCount":924,"commentCount":3,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-struts-logo.jpg","keywords":["Apache Struts","jQuery"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html","url":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html","name":"Query grid with struts 2 without plugin - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-struts-logo.jpg","datePublished":"2012-06-13T01:00:00+00:00","dateModified":"2012-10-22T05:38:05+00:00","description":"When using jQuery with struts 2, the developers are persuaded to use struts2-jQuery plug-in. Because most of the forums and other Internet resources","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-struts-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-struts-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/query-grid-with-struts-2-without-plugin.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Query grid with struts 2 without plugin"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/511aa57cb783e9e45ebbdfbaeea786e1","name":"Semika Kaluge","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/19ddbcbcd7a71589e915a5fe88bc5478d414fb1a8b35504d927473cb74abf9a1?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/19ddbcbcd7a71589e915a5fe88bc5478d414fb1a8b35504d927473cb74abf9a1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/19ddbcbcd7a71589e915a5fe88bc5478d414fb1a8b35504d927473cb74abf9a1?s=96&d=mm&r=g","caption":"Semika Kaluge"},"description":"I am working in software engineering field for six years of time by now. Currently, I am working for Shipxpress Inc in Sri Lanka. Primarily, I love to involve with Java developments and related frameworks like Spring, Struts, Hibernate and many more, specially interested in Javascript.","sameAs":["http:\/\/semikas.blogspot.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/semika-kaluge"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/227"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=1402"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1402\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/81"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=1402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=1402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=1402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}