-
FEATURED COMPONENTS
First time here? Check out the FAQ!
This is my error
this is my controller :
package de.forsthaus.webui.blog; import mcrt.model.FunctionsServices; import mcrt.model.UserServices; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.util.GenericForwardComposer; import org.zkoss.zul.ListModelList; import org.zkoss.zul.Listbox; import org.zkoss.zul.ListitemRenderer; public class FunctionPop extends GenericForwardComposer{ /** * */ private Listbox listFunc; private ListModelList listModel; private static final long serialVersionUID = -5008511463280808309L; public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); listModel = new ListModelList(DummyFunction.getFunctionList()); listFunc.setItemRenderer(new FunctionRender()); listFunc.setModel(listModel); } public void onAfterRender$listGrid() { FunctionsServices fservices = new FunctionsServices(); for (int i = 0; i < fservices.findAll().size(); i++) { listFunc.renderItem(listFunc.getItemAtIndex(i)); } } }
this is my DummyFunction :
package de.forsthaus.webui.blog; import java.util.ArrayList; import mcrt.model.Functions; import mcrt.model.FunctionsServices; public class DummyFunction { private static ArrayList<Functions> functionList = new ArrayList<Functions>(); static { setFunctionList(); } public static ArrayList<Functions> getFunctionList() { return functionList; } private static void setFunctionList() { FunctionsServices uservices = new FunctionsServices(); for (int i = 0; i < uservices.findAll().size() - 1; i++) { Functions func = new Functions(); //func.setsDescription(uservices.findAll().get(i).getsDescription()); functionList.add(new Functions(uservices.findAll().get(i).getID(),uservices.findAll().get(i).getFunctionName(),uservices.findAll().get(i).getFunctionURL())); } } }
This is my FunctionRender:
package de.forsthaus.webui.blog; import mcrt.model.Functions; import org.zkoss.zk.ui.sys.ComponentsCtrl; import org.zkoss.zul.Listcell; import org.zkoss.zul.Listitem; import org.zkoss.zul.ListitemRenderer; public class FunctionRender implements ListitemRenderer{ public void render(Listitem item, Object data) throws Exception { Functions func = (Functions) data; item.setValue(func); item.setAttribute("data", data); ComponentsCtrl.applyForward(item, "onDoubleClick=onDoubleClicked"); Listcell lc; lc = new Listcell(String.valueOf(func.getID()));lc.setParent(item); lc = new Listcell(String.valueOf(func.getFunctionName())); lc.setParent(item); lc = new Listcell(String.valueOf(func.getFunctionURL()));lc.setParent(item); } }
this is my FunctionServices:
package mcrt.model; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import java.util.LinkedList; import mcrt.config.ConnectODBC_DSN; public class FunctionsServices implements FunctionInterface{ // data model private List<Functions> func = new LinkedList<Functions>(); public FunctionsServices() { try { try { ConnectODBC_DSN conDSN = new ConnectODBC_DSN(); ResultSet rs = conDSN.GetResultSet("tblFunctions"); while (rs.next()) { String ID = rs.getString("ID"); String FunctionName = rs.getString("FunctionName"); String FunctionURL = rs.getString("FunctionURL"); func.add(new Functions(ID, FunctionName,FunctionURL) ); } } catch (SQLException s) { System.out.println("SQL statement is not executed!"); } } catch (Exception a) { a.printStackTrace(); } } @Override public List<Functions> findAll() { return func; } //Search with UserID @Override public List<Functions> getDetails(String keyword) { try { try { ConnectODBC_DSN conDSN = new ConnectODBC_DSN(); ResultSet rs = conDSN.processSQL("select * from tblFunctions where FunctionName=" + keyword); while (rs.next()) { String ID = rs.getString("ID"); String FunctionName = rs.getString("FunctionName"); String FunctionURL = rs.getString("FunctionURL"); func.add(new Functions(ID, FunctionName,FunctionURL) ); } } catch (SQLException s) { System.out.println("SQL statement is not executed!"); } } catch (Exception a) { a.printStackTrace(); } return func; } @Override public String insertFunction(String FunctionName,String FunctionURL) { System.out.println("name: "+FunctionName + " url: " + FunctionURL); try { try { ConnectODBC_DSN conDSN = new ConnectODBC_DSN(); conDSN.executeSQL("insert into tblFunctions(FunctionName,FunctionURL) values('" + FunctionName + "','" + FunctionURL + "')"); return "success"; } catch (SQLException s) { System.out.println("SQL statement is not executed!"); return "error"; } } catch (Exception a) { a.printStackTrace(); return "error"; } } }
all code i think it very normal , and I implement them to another page , it ok, but when I implement them at FunctionController then it got error as you see in my picture
PLEASE HELP ME :(
Hi
Please also post zul page. You can also post your code in zkfiddle that we can see the execution result online.
Asked: 2013-01-18 02:30:52 +0800
Seen: 39 times
Last updated: Jan 18 '13