Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search Coderanch
Advance search
Google search
Register / Login
luckay win
Ranch Hand
+ Follow
news
36
Posts
17
Threads
since Sep 21, 2010
Merit badge:
grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads
Recent posts by luckay win
example for how to save JSON data to Database (JDBC)
Sorry,
I am very new to struts2 .. but you said "...as JSON data is just a text string"..
could you please more detail? or hopefully you can give me a simple example for just a clue?
many thanks in advance
Regards
Luc
show more
13 years ago
Other Application Frameworks
example for how to save JSON data to Database (JDBC)
Hello All,
I am looking for example for how to save JSON data to Database (JDBC)
could any body please help
thanks & Regards
Luc
show more
13 years ago
Other Application Frameworks
How to present checkbox on boolean type column of JQuery-Grid?
Dear All,
How to present checkbox on boolean type column of JQuery-Grid?
please help
Thanks & regards
Luc
show more
13 years ago
Struts
How to present checkbox on boolean type column of JQuery-Grid?
Dear All,
How to present checkbox on boolean type column of JQuery-Grid?
please help
Thanks & regards
Luc
show more
13 years ago
HTML Pages with CSS and JavaScript
How to save jquery-grid to MySql database table?
Hello All,
How to save jquery-grid to MySql database table?
I need advise
thanks & regards
Luckay
show more
13 years ago
Struts
Unable to load configuration. - [unknown location]
Hello All,
Why I got this message???
"Unable to load configuration. - [unknown location]"
this message really uninformative! ..
show more
13 years ago
Struts
add,edit,delete mode on JQuery-Grid?
hmm.. so what is in struts.xml?
show more
13 years ago
HTML Pages with CSS and JavaScript
add,edit,delete mode on JQuery-Grid?
Thanks, but could you please advise where should I put these .js below:
$.subscribe('rowselect', function(event,data) { $("#gridinfo").html('<p>Edit Mode for Row : '+event.originalEvent.id+'</p>'); }); $.subscribe('rowadd', function(event,data) { $("#gridedittable").jqGrid('editGridRow',"new",{height:280,reloadAfterSubmit:false}); }); $.subscribe('searchgrid', function(event,data) { $("#gridedittable").jqGrid('searchGrid', {sopt:['cn','bw','eq','ne','lt','gt','ew']} ); }); $.subscribe('showcolumns', function(event,data) { $("#gridedittable").jqGrid('setColumns',{}); }); </pre>
and what's inside simpleecho.jsp?
many thanks in advance
Regards
Luc
show more
13 years ago
HTML Pages with CSS and JavaScript
add,edit,delete mode on JQuery-Grid?
Hello All,
Where can I download complete example of JQuery-Grid especially for edit, add, delete records?
I tried to the simple instruction
http://code.google.com/p/struts2-jquery/wiki/EditGrid
.. but no luck
and also tried to follow from the grid showcase (
http://www.weinfreund.de/struts2-jquery-showcase/index.action
) .. and still not understand ...(ie. where should I put the javascript, struts.xml .. etc)
could any body please help me to start learn add,edit,delete mode on JQuery-Grid?
many thanks in advance
Regards
Luc
show more
13 years ago
HTML Pages with CSS and JavaScript
Struts-JQuery grid, how to set font-size to the title of each grid column?
Thanks for the clue Johannes
it resolved now!
show more
13 years ago
Struts
Struts-JQuery grid, how to set font-size to the title of each grid column?
Dear All.
Anybody, please advise.. how to set font-size to the title of each
grid column?
I tried below .. but not working:
<%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> <%@ taglib prefix="sj" uri="/struts-jquery-tags" %> <%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %> <html> <head> <title>Welcome to JQuery Grid</title> <sj:head jqueryui="true" jquerytheme="redmond" /> <style type="css/text"> .ui-widget {font-size:10px; } </style> </head> <body> <s:url id="jsonurl" action="jsontable" /> <sjg:grid cssStyle="font-size: 12px" id="gridtable" caption="Customer Examples" dataType="json" href="%{jsonurl}" pager="true" gridModel="gridModel" rowList="10,15,20" rowNum="15" rownumbers="true" navigator="true" navigatorSearch="true" navigatorSearchOptions="{multipleSearch:true}" viewrecords="true" > <sjg:gridColumn name="id" index="id" title="ID" formatter="integer" sortable="false" /> <sjg:gridColumn name="name" index="name" title="Name" sortable="true" /> <sjg:gridColumn name="email" index="email" title="Email" sortable="false" /> <sjg:gridColumn name="remarks" index="remarks" title="Remarks" sortable="false" /> </sjg:grid> </body> </html>
show more
13 years ago
Struts
Datagrid in struts page
any clue? .. how to show records to the grid?
the codes below compiled with no errors or warnings .. but still unable to show the records array into the grid.. it seems like the gridModel does not effect the .jsp
page..
private List<Host> gridModel; private List<Host> myHosts; private Integer rows = 0; private Integer page = 0; private Integer total = 0; private Integer record = 0; private String sord; private String sidx; private String searchField; private String searchString; private String searchOper; private boolean loadonce = false; private Map<String, Object> session; 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) { myHosts = (List<Host>) list; } else { log.debug("Build new List"); myHosts = HostDAO.buildList(); } if (getSord() != null && getSord().equalsIgnoreCase("asc")) { Collections.sort(myHosts); } if (getSord() != null && getSord().equalsIgnoreCase("desc")) { Collections.sort(myHosts); Collections.reverse(myHosts); } setRecord(HostDAO.getHostCount(myHosts)); int to = (getRows() * getPage()); int from = to - getRows(); if (to > getRecord()) to = getRecord(); if (loadonce) { setGridModel(myHosts); } else { if (searchString != null && searchOper != null) { int id = Integer.parseInt(searchString); if (searchOper.equalsIgnoreCase("eq")) { log.debug("search id equals " + id); List<Host> cList = new ArrayList<Host>(); cList.add(HostDAO.findById(myHosts, id)); setGridModel(cList); } else if (searchOper.equalsIgnoreCase("ne")) { log.debug("search id not " + id); setGridModel(HostDAO.findNotById(myHosts, id, from, to)); } else if (searchOper.equalsIgnoreCase("lt")) { log.debug("search id lesser then " + id); setGridModel(HostDAO.findLesserAsId(myHosts, id, from, to)); } else if (searchOper.equalsIgnoreCase("gt")) { log.debug("search id greater then " + id); setGridModel(HostDAO.findGreaterAsId(myHosts, id, from, to)); } } else { setGridModel(HostDAO.getHosts(myHosts, from, to)); } } setTotal((int) Math.ceil((double) getRecord() / (double) getRows())); session.put("mylist", myHosts); // myHosts already had array values .. return SUCCESS; }
<%@ taglib prefix="s" uri="/struts-tags"%> <%@ taglib prefix="sj" uri="/struts-jquery-tags"%> <%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%> <html> <head> <sj:head jqueryui="true" jquerytheme="redmond" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JQuery Grid Page</title> </head> <body> <h1>Hello World!</h1> <h2><s:property value="message"/></h2> <s:url id="remoteurl" action="doHelloStruts2p3"/> <sjg:grid id="gridtable" caption="Host Examples" dataType="json" href="%{remoteurl}" pager="true" gridModel="gridModel" rowList="10,15,20" rowNum="15" rownumbers="true" navigator="true" navigatorSearch="true" navigatorSearchOptions="{multipleSearch:true}" > <sjg:gridColumn name="hostid" index="hostid" title="ID" formatter="integer" sortable="false"/> <sjg:gridColumn name="hostname" index="hostname" title="Name" sortable="true"/> <sjg:gridColumn name="email" index="email" title="Email" sortable="true"/> <sjg:gridColumn name="remarks" index="remarks" title="Remarks" sortable="false"/> </sjg:grid> </body> </html>
show more
14 years ago
Struts
newbie, execute method not working
Thanks and yes it works with 2 .jsp ..
but still don't understand why it does not work if just 1 .jsp..
show more
14 years ago
Struts
java.lang.UnsupportedOperationException: Not supported yet
Thanks,
I knew the problem will not occurs if I removed "implements SessionAware" .. but I don't understandy why ?..
so I thought the problem is not from: Object list = session.get("mylist"); line as I said before.
could you please advise what's going on there?
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package example; import java.util.ArrayList; import java.util.List; import java.util.Map; import com.opensymphony.xwork2.ActionSupport; import java.sql.SQLException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Actions; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.interceptor.SessionAware; /** * * @author luckay */ public class JQueryGrid extends ActionSupport implements SessionAware { private String message; private static final long serialVersionUID = 5078264277068533593L; private static final Log log = LogFactory.getLog(JQueryGrid.class); private List<Host> gridModel; private Integer rows = 0; private Integer page = 0; private Integer total = 0; private Integer record = 0; private String sord; private String sidx; private String searchField; private String searchString; private String searchOper; private boolean loadonce = false; private Map<String, Object> session; private List<Host> myHost; @Actions({ @Action(value = "/JQueryGrid", results = { @Result(name = "success", type = "json") }) }) @Override public String execute() { try { setMessage("Hello Every body in Struts 2"); System.out.println(session.getClass().getName()); Object list = session.get("mylist"); if (list != null) { myHost = (List<Host>) list; } else { myHost = HostDAO.buildList(); } setRecord(HostDAO.getHostCount(myHost)); int to = (getRows() * getPage()); int from = to - getRows(); if (to > getRecord()) { to = getRecord(); } if (loadonce) { // All Custumer setGridModel(myHost); } else { // Search Custumers if (searchString != null && searchOper != null) { int id = Integer.parseInt(searchString); if (searchOper.equalsIgnoreCase("eq")) { log.debug("search id equals " + id); List<Host> cList = new ArrayList<Host>(); Host host = HostDAO.findById(myHost, id); if (host != null) { cList.add(host); } setGridModel(cList); } else if (searchOper.equalsIgnoreCase("ne")) { log.debug("search id not " + id); setGridModel(HostDAO.findNotById(myHost, id, from, to)); } else if (searchOper.equalsIgnoreCase("lt")) { log.debug("search id lesser then " + id); setGridModel(HostDAO.findLesserAsId(myHost, id, from, to)); } else if (searchOper.equalsIgnoreCase("gt")) { log.debug("search id greater then " + id); setGridModel(HostDAO.findGreaterAsId(myHost, id, from, to)); } } else { setGridModel(HostDAO.getHosts(myHost, from, to)); } } setTotal((int) Math.ceil((double) getRecord() / (double) getRows())); //session.put("mylist", myHost); } catch (Exception ex) { System.out.println(session.getClass().getName()); } return SUCCESS; } public String getJSON() throws SQLException { return execute(); } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } /** * @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 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 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<Host> getGridModel() { return gridModel; } /** * @param gridModel * an collection that contains the actual data */ public void setGridModel(List<Host> gridModel) { this.gridModel = gridModel; } @Override public void setSession(Map<String, Object> map) { throw new UnsupportedOperationException("Not supported yet."); } }
show more
14 years ago
Struts
java.lang.UnsupportedOperationException: Not supported yet
Hello All,
I am facing with "java.lang.UnsupportedOperationException: Not supported yet."
on my code
private Map<String, Object> session;
public String execute() {
Object list = session.get("mylist"); // this line thrown "java.lang.UnsupportedOperationException: Not supported yet."
could any body please help?
thanks & regards
Luc
show more
14 years ago
Struts