AW: Selection list populated from Hibernate POJO
1 answers - 3472 bytes -

Hello again Ugo
It doesnt seem to work for me, I get java.lang.ClassCastException:
Error executing pipeline.: Error executing pipeline.: java.lang.ClassCastException
at ()
at ()
at ()
at (SerializeNode.java:120)
at ()
at (ContainerNode.java:31)
at (CallNode.java:93)
at ()
at (PreparableMatchNode.java:130)
at ()
at (ActTypeNode.java:138)
at ()
at (PipelineNode.java:138)
at ()
at (PipelinesNode.java:92)
at (ConcreteTreeProcessor.java:234)
at (ConcreteTreeProcessor.java:176)
at (TreeProcessor.java:243)
at (Cocoon.java:608)
at (CocoonServlet.java:1123)
at (HttpServlet.java:802)
at ()
at ()
at (HibernateFilter.java:57)
at ()
at ()
at (StandardWrapperValvejava:214)
at (StandardValveContext.java:104)
at (StandardPipeline.java:520)
at (StandardContextValve.java:198)
at (StandardContextValvejava:152)
at (StandardValveContext.java:104)
at (StandardPipeline.java:520)
at (StandardHostValve.java:137)
at (StandardValveContext.java:104)
at (ErrorReportValve.java:118)
at (StandardValveContext.java:102)
at (StandardPipeline.java:520)
at (StandardEngineValve.java:109)
at (StandardValveContext.java:104)
at (StandardPipeline.java:520)
at (ContainerBase.java:929)
at (CoyoteAdapter.java:160)
at (Http11Processor.java:799)
at $(Http11Protocol.java:705)
at (PoolTcpEndpoint.java:577)
at $ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: Error executing pipeline.: java.lang.ClassCastException
at (SitemapSource.java:423)
at (SourceUtil.java:270)
at (ContentAggregator.java:125)
at ()
46 more
Here is my flowscript :
function callRestaurantMainSearch() {
var restTypes = new Array(4);
restTypes[0] = new ("Italian" , 1);
restTypes[1] = new ("German" , 2);
restTypes[2] = new ("French" , 3);
restTypes[3] = new ("Chinese" , 4);
var form = new Form("");
form.lookupWidget("type").setSelectionList(restTypes, "id", "name");
form.showForm("");
}
My class is a Pojo with getId and getName methods.
My form xml is :
<fd:field id="type">
<fd:label>Type</fd:label>
<fd:datatype base="string"/>
<fd:selection-list />
</fd:field>
</fd:widgets>
What is wrong ?
Thanks !
Elad
Nachricht
Von: Ugo Cei [mailto:ugo (AT) apache (DOT) org]
Gesendet: Montag, 23. Mai 2005 14:01
An: users (AT) cocoon (DOT) apache.org
Betreff: Re: Selection list populated from Hibernate PJ
Il giorno 23/mag/05, alle 13:39, Messing, Elad ha scritto:
******* I have a Hibernate PJ class - for a restaurant type. It is
actually a mapping of a look-up table from my DB. An ID, and Name
members. That's it.
Two possibilities come to mind:
A) use the src attribute and make it point to a pipeline that would query the Hibernate datastore and output some XML. You don't have to have Hibernate output XML, as you wrote: you can have a flowscript function do the query and produce XML via a template page (JXTG or Velocity). even an XSP page.
B) possibly simpler:
var form = new Form("formdef.xml");
var list = hibernateSession.find("from "); form.lookupWidget("widget-id").setSelectionList(list, "id", "name"); form.showForm("form-template");
HTH,
Ugo
No.1 | | 697 bytes |
| 
Il giorno 23/mag/05, alle 15:32, Messing, Elad ha scritto:
Hello again Ugo
It doesnt seem to work for me, I get java.lang.ClassCastException:
<snip/>
Here is my flowscript :
--
function callRestaurantMainSearch() {
var restTypes = new Array(4);
restTypes[0] = new
("Italian" , 1);
restTypes[1] = new
("German" , 2);
restTypes[2] = new
("French" , 3);
restTypes[3] = new
("Chinese" , 4);
var form = new Form("");
form.lookupWidget("type").setSelectionList(restTypes, "id",
"name");
form.showForm("");
}
<snip/>
What is wrong ?
You should pass it an instance of java.util.List, not an array.
Ugo