Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830
this week in the
Programmer Certification
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
paul wheaton
Sheriffs:
Ron McLeod
Devaka Cooray
Henry Wong
Saloon Keepers:
Tim Holloway
Stephan van Hulst
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Frits Walraven
Forum:
Struts
[struts2] [Jqueryplugin 3.0.2] showcase.war -> grid
khekhone yvan
Ranch Hand
Posts: 79
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
i deploy war but i dont understand the JsonTable.java
there something magic on this code
.
i cannot see how the my list was stored
code JSONTable
public String execute() { log.debug("Page " + getPage()+" Rows " + getRows() +" Sorting Order "+ getSord()+" Index Row :" + getSidx()); log.debug("Search :" + searchField + " " + searchOper + " " + searchString); Object list = session.get("mylist"); if (list != null) { myCustomers = (List<Customer>) list; } else { log.debug("Build new List"); myCustomers = CustomerDAO.buildList(); } if (getSord() != null && getSord().equalsIgnoreCase("asc")) { Collections.sort(myCustomers); } if (getSord() != null && getSord().equalsIgnoreCase("desc")) { Collections.sort(myCustomers); Collections.reverse(myCustomers); } setRecord(CustomerDAO.getCustomersCount(myCustomers)); int to = (getRows() * getPage()); int from = to - getRows(); if (to > getRecord()) to = getRecord(); if (loadonce) { setGridModel(myCustomers); } else { if (searchString != null && searchOper != null) { int id = Integer.parseInt(searchString); if (searchOper.equalsIgnoreCase("eq")) { log.debug("search id equals " + id); List<Customer> cList = new ArrayList<Customer>(); cList.add(CustomerDAO.findById(myCustomers, id)); setGridModel(cList); } else if (searchOper.equalsIgnoreCase("ne")) { log.debug("search id not " + id); setGridModel(CustomerDAO.findNotById(myCustomers, id, from, to)); } else if (searchOper.equalsIgnoreCase("lt")) { log.debug("search id lesser then " + id); setGridModel(CustomerDAO.findLesserAsId(myCustomers, id, from, to)); } else if (searchOper.equalsIgnoreCase("gt")) { log.debug("search id greater then " + id); setGridModel(CustomerDAO.findGreaterAsId(myCustomers, id, from, to)); } } else { setGridModel(CustomerDAO.getCustomers(myCustomers, from, to)); } } setTotal((int) Math.ceil((double) getRecord() / (double) getRows())); session.put("mylist", myCustomers); return SUCCESS; } public String getJSON() { return execute(); } /** * @return how many rows we want to have into the grid */ public Integer getRows() { return rows; } /** * @param rows * how many rows we want to have into the grid */ public void setRows(Integer rows) { this.rows = rows; } /** * @return current page of the query */ public Integer getPage() { return page; } /** * @param page * current page of the query */ public void setPage(Integer page) { this.page = page; } /** * @return total pages for the query */ public Integer getTotal() { return total; } /** * @param total * total pages for the query */ public void setTotal(Integer total) { this.total = total; } /** * @return total number of records for the query. e.g. select count(*) from * table */ public Integer getRecord() { return record; } /** * @param record * total number of records for the query. e.g. select count(*) from * table */ public void setRecord(Integer record) { this.record = record; if (this.record > 0 && this.rows > 0) { this.total = (int) Math.ceil((double) this.record / (double) this.rows); } else { this.total = 0; } } /** * @return an collection that contains the actual data */ public List<Customer> getGridModel() { return gridModel; } /** * @param gridModel * an collection that contains the actual data */ public void setGridModel(List<Customer> gridModel) { this.gridModel = gridModel; } /** * @return sorting order */ public String getSord() { return sord; } /** * @param sord * sorting order */ public void setSord(String sord) { this.sord = sord; } /** * @return get index row - i.e. user click to sort. */ public String getSidx() { return sidx; } /** * @param sidx * get index row - i.e. user click to sort. */ public void setSidx(String sidx) { this.sidx = sidx; } public void setSearchField(String searchField) { this.searchField = searchField; } public void setSearchString(String searchString) { this.searchString = searchString; } public void setSearchOper(String searchOper) { this.searchOper = searchOper; } public void setLoadonce(boolean loadonce) { this.loadonce = loadonce; } public void setSession(Map<String, Object> session) { this.session = session; } }
when the application store on the map ?
Honk if you love justice! And honk twice for tiny ads!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
[Struts2][Jqueryplugin] problem to populate grid .
Data not get displayed in struts2 - jquery grid
struts2 + Json and JQuery.
Datagrid in struts page
java.lang.UnsupportedOperationException: Not supported yet
More...