0

zk jsp help

asked 2010-12-03 06:58:05 +0800

pritamdebnath9 gravatar image pritamdebnath9
3

i am having a peculiar problem binding data in a autocomplete(autodrop) combobox using zkjsp.The problem lies in the <z:zscript></z:zscript> portion.

i am using struts1 with hibernate3.my jsp page is as follows.

subscriberlist.jsp


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<%@include file="commonheader.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Subscriber Master</title>

</head>
<body>
<z:page>
<center><z:hbox>
SEARCH BY:
<z:combobox id="combo1" autodrop="true" mold="rounded">
<z:comboitem label="UA KEY" />
<z:comboitem label="SUBSCRIBER CODE" />
<z:comboitem label="SUBSCRIBER NAME" />
<z:comboitem label="TELEPHONE NO" />
</z:combobox>
KEYWORD:
<z:combobox id="combo2" autodrop="true" mold="rounded"
onChange="populate()">
<z:zscript>
import hibernate.Complainmaster;
import com.hibernate.DAO.*;
ComplainmasterHome complainmasterHome=new ComplainmasterHome();

void populate(){

Combobox c1=(Combobox)Path.getComponent("/combo1");


if(c1.getValue().equals("UA KEY")){

Combobox c2=(Combobox)Path.getComponent("/combo2");
String keyword=c2.getValue();
List list=(List)complainmasterHome.getListByUakey(keyword);
Iterator it = list.iterator();
String[] data = new String[500];
int x=0;
while(it.hasNext()){
Complainmaster complainmaster=(Complainmaster)it.next();
data=complainmaster.getSubscribermaster().getSettopboxmaster().getVcnumber().toLowerCase();
x++;
}

ListModel listModel = new SimpleListModel(data);

c2.setModel(listModel);
}
}



</z:zscript>
</z:combobox>
<z:hlayout>
<z:label value=" " pre="true" />
<z:button label="GO" />
</z:hlayout>
</z:hbox></center>
</z:page>
</body>
</html>

my error stack is like::


Dec 3, 2010 6:26:47 PM org.zkoss.zk.ui.impl.UiEngineImpl handleError:1253
SEVERE: >>java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
>> at org.zkoss.zk.ui.event.SelectEvent.getSelectEvent(SelectEvent.java:60)
>> at org.zkoss.zul.Combobox.service(Combobox.java:597)
>> at org.zkoss.zk.ui.impl.DesktopImpl.service(DesktopImpl.java:684)
>> at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1378)
>> at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1095)
>> at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:561)
>>...

plz plz help

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2011-01-25 01:26:28 +0800

kalagarlap gravatar image kalagarlap
12

I am getting the same error ! Plz help !!

link publish delete flag offensive edit

answered 2011-01-27 19:31:22 +0800

PeterKuo gravatar image PeterKuo
481 2

@kalagarlap
Can you provide your sample code and tell us your environment?

link publish delete flag offensive edit

answered 2011-01-27 19:44:27 +0800

PeterKuo gravatar image PeterKuo
481 2

data=complainmaster.getSubscribermaster().getSettopboxmaster().getVcnumber().toLowerCase();

ListModel listModel = new SimpleListModel(data);


SimpleListModel() doesn't accept String as input.
You may look into the api.
It's harder to find such problem in zscript,
It would be easy to found such bug, if using java syntax check.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-12-03 06:58:05 +0800

Seen: 803 times

Last updated: Jan 27 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More