You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Kim Jelmoni <ki...@otego.com> on 2003/10/16 11:47:17 UTC
woody - fill selection list with bean
Hi,
I m trying to fill a selection list with a collection using woody and
cocoon 2.1.3-dev .
I got in select_bind_bind.xml
<wb:context xmlns:wb="http://apache.org/cocoon/woody/binding/1.0" path="/" >
<wb:repeater id="aliases"
parent-path="."
row-path="aliases"
unique-row-id="aliasId"
unique-path="@aliasId">
<wb:on-bind>
<wb:value id="aliasId" path="aliasId"/>
<wb:value id="aliasText" path="aliasText"/>
</wb:on-bind>
</wb:repeater>
</wb:context>
and in the model i tried something like :
<?xml version="1.0" encoding="ISO-8859-1"?>
<wd:form
xmlns:wd="http://apache.org/cocoon/woody/definition/1.0"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<wd:field id="aliasesWzd" required="false">
<wd:label>Chose the error <b>level</b> to show</wd:label>
<wd:datatype base="string"/>
<wd:selection-list dynamic="true">
<wd:repeater id="aliases">
<wd:item id="aliasId">
<wd:label id="aliasText" />
</wd:item>
</wd:repeater>
</wd:selection-list>
</wd:field>
</wd:form>
that don't work (null pointer exception).
How should be done ?
Thanks
Kim
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: woody - fill selection list with bean
Posted by Ugo Cei <u....@cbim.it>.
Bruno Dumon wrote:
> On Thu, 2003-10-16 at 11:47, Kim Jelmoni wrote:
>>I m trying to fill a selection list with a collection using woody and
>>cocoon 2.1.3-dev .
> If you want a selectionlist to be filled with data from a collection,
> you need to create an implementation of the SelectionList interface, and
> then you can call field.setSelectionList(...) with as parameter your
> selection list.
I've been trying to implement this for a few days, which were mainly
spent trying to understand how Woody works. Hopefully that phase is now
over and I'll be able to commit the feature to CVS in the coming days.
Ugo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: woody - fill selection list with bean
Posted by Bruno Dumon <br...@outerthought.org>.
On Thu, 2003-10-16 at 11:47, Kim Jelmoni wrote:
> Hi,
>
> I m trying to fill a selection list with a collection using woody and
> cocoon 2.1.3-dev .
>
> I got in select_bind_bind.xml
>
> <wb:context xmlns:wb="http://apache.org/cocoon/woody/binding/1.0" path="/" >
>
> <wb:repeater id="aliases"
> parent-path="."
> row-path="aliases"
> unique-row-id="aliasId"
> unique-path="@aliasId">
>
> <wb:on-bind>
> <wb:value id="aliasId" path="aliasId"/>
> <wb:value id="aliasText" path="aliasText"/>
> </wb:on-bind>
> </wb:repeater>
>
> </wb:context>
>
> and in the model i tried something like :
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <wd:form
> xmlns:wd="http://apache.org/cocoon/woody/definition/1.0"
> xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
>
> <wd:field id="aliasesWzd" required="false">
> <wd:label>Chose the error <b>level</b> to show</wd:label>
> <wd:datatype base="string"/>
> <wd:selection-list dynamic="true">
> <wd:repeater id="aliases">
> <wd:item id="aliasId">
> <wd:label id="aliasText" />
> </wd:item>
> </wd:repeater>
> </wd:selection-list>
> </wd:field>
>
> </wd:form>
>
> that don't work (null pointer exception).
>
> How should be done ?
Setting a selection list using the binding is currently not supported.
Using the wd:selection-list tag you can either refer to an external
source (using the src attribute), or list the items inline in the form
definition.
Putting a repeater inside a wd:selection-list element makes no sense at
all. A repeater is a widget and can only appear where widgets are
allowed, i.e. as child of the wd:form or wd:repeater elements. Inside
wd:selection-list only wd:item's are allowed. Also, the dynamic
attribute you used only has a meaning when used in combination with the
src attribute.
If you want a selectionlist to be filled with data from a collection,
you need to create an implementation of the SelectionList interface, and
then you can call field.setSelectionList(...) with as parameter your
selection list.
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org bruno@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org