You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Hans-Christian Meier <ha...@gmail.com> on 2008/06/05 10:44:29 UTC

JXPath selection lists and maps

Hello,

I work with Cocoon 2.1.10 and JXPath selection lists. According to the
API a MultiValueField accepts Java collections so I assume it also
works with a Map.

In case of an ArrayList I can write widget.setSelectionList(array,
".", "."). When I try this with a Map I get an exception:
java.lang.ClassCastException:
java.util.TreeMapjava.util.TreeMapresource://org/apache/cocoon/forms/generation/jx-macros.xml
- 6:1827
Caused by: org.mozilla.javascript.WrappedException: Wrapped
org.apache.cocoon.generation.JXTemplateGenerator$JXTException:
java.util.TreeMap

Any ideas?

Thanks in advance!
Hans

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXPath selection lists and maps

Posted by Hans-Christian Meier <ha...@gmail.com>.
Hello Rainer,

oh, of course you're right.

Thanks for the fast response!

2008/6/5 Rainer Pruy <Ra...@acrys.com>:
> Sorry,
> but a map is *not* a collection.
> (it is not drived from Collection base class)
>
> You might try using the set of keys (.keySet()) or the collection of values (.values()) from the map
> according to your needs.
>
> Rainer
>
> Hans-Christian Meier schrieb:
>> Hello,
>>
>> I work with Cocoon 2.1.10 and JXPath selection lists. According to the
>> API a MultiValueField accepts Java collections so I assume it also
>> works with a Map.
>>
>> In case of an ArrayList I can write widget.setSelectionList(array,
>> ".", "."). When I try this with a Map I get an exception:
>> java.lang.ClassCastException:
>> java.util.TreeMapjava.util.TreeMapresource://org/apache/cocoon/forms/generation/jx-macros.xml
>> - 6:1827
>> Caused by: org.mozilla.javascript.WrappedException: Wrapped
>> org.apache.cocoon.generation.JXTemplateGenerator$JXTException:
>> java.util.TreeMap
>>
>> Any ideas?
>>
>> Thanks in advance!
>> Hans
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXPath selection lists and maps

Posted by Rainer Pruy <Ra...@Acrys.COM>.
Sorry,
but a map is *not* a collection.
(it is not drived from Collection base class)

You might try using the set of keys (.keySet()) or the collection of values (.values()) from the map
according to your needs.

Rainer

Hans-Christian Meier schrieb:
> Hello,
> 
> I work with Cocoon 2.1.10 and JXPath selection lists. According to the
> API a MultiValueField accepts Java collections so I assume it also
> works with a Map.
> 
> In case of an ArrayList I can write widget.setSelectionList(array,
> ".", "."). When I try this with a Map I get an exception:
> java.lang.ClassCastException:
> java.util.TreeMapjava.util.TreeMapresource://org/apache/cocoon/forms/generation/jx-macros.xml
> - 6:1827
> Caused by: org.mozilla.javascript.WrappedException: Wrapped
> org.apache.cocoon.generation.JXTemplateGenerator$JXTException:
> java.util.TreeMap
> 
> Any ideas?
> 
> Thanks in advance!
> Hans
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org