cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dev at weitling <d...@weitling.net>
Subject Re: HashMap in repeater binding via javascript
Date Fri, 04 Jan 2008 10:26:40 GMT
Hi Harald,

thanks for your help, but it I'm sorry to say it doesn't match my problem.
An example:
    Map<String,String> locales = new HashMap<String,String>();
    locales.put("de","deutsch");
    locales.put("en","english");
    locales.put("fr","francais");

I now want a repeater binding iterating over the keys with presenting
the keys with their values in the template, something like (doesn't work!):
    <fb:repeater id="localeRepeater" path="locales">
        <fb:identity>
           <fb:value id="key" path="key"/>
        </fb:identity>
        <fb:on-bind>
           <fb:value id="value" path="value"/>
        </fb:on-bind>
    </fb:repeater>

Alas, Map defines methods keySet() instead of getKeySet(). entrySet()
returns a Set with MapEntry-objects with getKey()/getValue(), but it's
name should be getEntrySet(). *Argh*

So I have to provide a custom binding via Javascript or Java.

:-?
Florian


Harald Entner wrote:
> Hi Florian,
>
> maybe this piece of information can be useful for you.
>
> We have a bean with a property stringObjects,
> which is declared as a Map to store various string objects.
>
> the xdoclet definition:
>
> @hibernate.map lazy="true" cascade="all" inverse="false"
> table="PepProduct_stringobjects"
> @hibernate.key column="UID"
> @hibernate.map-key type="string" column="name"
> @hibernate.element type="string" column="element" length="2000"
>
> and the binding:
>
> <fb:value id="phCalculation"
> path="stringObjects[@name='phCalculation']" direction="both"/>
>
> this configuration works well.Keep in mind that the @name attribute
> has to match
> the @hibernate.map-key.
>
> Hope it helps,
>
> regards, Harald
>
>
>
>
>
> Dev at weitling schrieb:
>> Hi folks,
>>
>> I'm getting nuts on this problem:
>> I have a HashMap which should be the bean for a repeater with the keys
>> as identity on each repeater row. Because JXPath relies on the
>> get-/set-naming-scheme but Sun didn't provide it for their collection
>> classes I can't use it the normal way.
>> Subclassing HashMap for providing the getter-methods on my own doesn't
>> work because I'm using Hibernate (and therefore the Map-interface).
>> So I try to use fb:javascript withing the repeater's binding. But
>> information is very sparse and not really helpful.
>>
>> Any experiences out there?
>> Florian
>>
>> ---------------------------------------------------------------------
>> 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


Mime
View raw message