Hugo Burm wrote:

Marc Portier wrote:


Hugo Burm wrote:


Hello Marc,


sorry for the late reply...



Ok. Let me explain. Maps are sometimes much more convenient than Lists
(let's skip a discussion on that one). So I have two classes:

<SKIP/>


Well, for what its worth the not to have discussion is probably
not on LIST vs MAP but MAP vs SET :-)

I'ld personally would have tackled this with a HashSet of
contacts and adding the appropriate hashcode() and equals()
methods to the HContact so its very own id would serve as the
fast lookup in the Set...

(but it doesn't really change much the real issue here)


What I want to do is: create a Map of contacts in HForm2Bean and access
these contacts with a key "id".
This key is also stored in one of the fields of HContact (id). The field
that is the key, should be one of the configuration parameters

of the Woody


repeater.

yep.



This solves your question "which key to use?".

not really, it doesn't solve the question on the way back, unless you expect the id's to be edited by hand?

(which would surely require another RepeaterBinding implementation)





I tried to ommit the persistence topic, but many of the issues above have to
do with the Hibernate framework I am using. E.g. the id is generated by
Hibernate. This works OK for the list implementation in Woody. The Woody
framework detects a contact that is inserted because its id is null. Then,
Hibernate generates the id when saving the contact to hard disk.

About lists, maps, and sets: Hibernate has four mappings: the three I just
mentioned, plus something called a "bag". So people like me will keep on
asking for repeaters for these three types. JDO 2.0 builds on Hibernate. So
I will not be the last one asking for this.



sure, and sorry if I ever gave you the impression that you were asking for 'bad' or useless things... I highly welcome any use case that shows an itch to scratch... at the time I just wanted some more clarification


thx for explaining the id generation thing, it adds to the food for thought on this


file "binding_example.js" in such a way that a bean and a

number of contacts


are created; the editing is skipped; and we go directly to your pipeline
"form2bean-success-pipeline", the form2_jx.xml form is called.

This contains


the loop:
     <jx:forEach var="item" items="${form2bean.contacts}">
       <tr>
         <td>${item.id}</td>
         <td>${item.firstName}</td>
         <td>${item.lastName}</td>
                                        <skip/>
       </tr>
     </jx:forEach>

This loops shows the correct results when I use a map instead of a list!

hm, my turn to be not convinced: above uses the ${..} expressions inside jx and not the #{..}

${..} in jx are evaluated by jexl
#{..} are covered by jxpath

so we're looking at a horse of an entirely different color here.





OK, may be I had too much sunshine the last couple of weeks. I did a post
myself about the difference between # and $ a few weeks ago which covered
exactly this problem:
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=106050576128633&w=2
I checked the JXPath docs and your explanation appears to be correct. Sorry.



no need to appologise, this confuses me all the time, in fact you had me doubthing my little technique for a while... so spotting the $# just gave me back some mental sanity :-)




Back to your issue: how to edit these beans with Woody/Binding?


I would need some more time to get into it more deeply, so I
wouldn't mind if somebody with more current slack hacks this up
ans shares this

Hugo, how urgent is this for you?

AFAICS this needs a different RepeaterBinding of some sort that
is not that much different to the existing one, just that





I hacked the Woody RepeaterBinding myself and solved my own urgent problem. Listing a map of contacts is working. Updating is working. Adding and deleting contacts is something I don't need at the moment (off course my real world problem has nothing to do with this form2bean and contact classes), but I will try to add this, and send the results to you.


thx chap, would surely like to see it, if you could hack it up as a an extra woody-sample (damn: there goes the hibernate-licensing issue again) that would be really great


you got this up on my todo list, if I reach this before you got the time to pollish up I might be asking for just sending what you have at the time, if you don't mind

Thanks.


Hugo Burm



regards, -marc= -- Marc Portier http://outerthought.org/ Outerthought - Open Source, Java & XML Competence Support Center Read my weblog at http://radio.weblogs.com/0116284/ [EMAIL PROTECTED] [EMAIL PROTECTED]



Reply via email to