Gianugo Rabellino wrote:

Today I got stuck using JXTG in what I thought would have been a quite common use case. I have to generate a cforms definition file (a selection list, actually) which is dynamically built from a bean that returns a Map.

This beans (which, BTW, is an Avalon component) resides in the session, so I thought that something along ${cocoon.session.getAtttribute('mybean').getMap()} or the equivalent #{$cocoon/session/attribute['mybean']/map} would have done the trick, but indeed that wasn't the case. I thought that there was something weird with the cocoon.session part, since is FOM bases and flow was involved only to a certain extent, so I resorted to a sitemap parameter:

<map:parameter name="mybean" value="{session-attr:mybean}"/>

but even this one seems unwilling to behave as I expected. The thing is that if I try just ${cocoon} I can see my parameter=MyBean there, and if I try ${cocoon.parameters.mybean} I indeed get a [EMAIL PROTECTED], so the object is there (pardon my funky syntax: I'm writing on a bus and don't have the actual code in front of me, please consider that I *think* I'm using a correct syntax. However, I'm still unable to access any accessor of my object: all I get is an empty evaluation that carries a firghtening nothing using Jexl syntax, and a non-existent path using JXPath's. I feel I'm doing something *horribly* wrong, but ATM I'm out of ideas. Any suggestions?


<map:parameter> are *strings*, meaning the "[EMAIL PROTECTED]" you got is the result of String.valueOf(Object).

Now why did cocoon.session.getAttribute('mybean') failed, I don't know.

A technique I often use to isolate this kind of evaluation problems is the JXTemplate equivalent of the good old println which simply consists in outputting the result of an expression in the resulting page.

Sylvain

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



Reply via email to