You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Philippe LAPLANCHE <ph...@horus-si.com> on 2006/03/31 22:11:00 UTC

jx template and arrays ... I need help

In my JXTemplate, this expression returns nothing: 

${account.payer.lines[5].CL1data.CL1_NUMLIG}

But in my flow, just before I call the sendPage() function, this
expression gives an int (I checked with the debugger)

My object seems to be correctly passed and the arrays of lines is really
there. Here's how I know :

<jx:forEach var="line" varStatus="status" items="${account.payer.lines}"
>
	${line.CL1data.CL1_NUMLIG} <br/>
</jx:forEach>

This returns a list with all the data I need.

Can someone understand what is happening here?

I'm using Cocoon 2.1.8 under win XP with Tomcat 5.5 and SUN JDK 1.5
 
Philippe



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


Re: jx template and arrays ... I need help

Posted by Jason Johnston <co...@lojjic.net>.
Philippe LAPLANCHE wrote:
> In my JXTemplate, this expression returns nothing: 
> 
> ${account.payer.lines[5].CL1data.CL1_NUMLIG}
> 
> But in my flow, just before I call the sendPage() function, this
> expression gives an int (I checked with the debugger)
> 
> My object seems to be correctly passed and the arrays of lines is really
> there. Here's how I know :
> 
> <jx:forEach var="line" varStatus="status" items="${account.payer.lines}"
> 	${line.CL1data.CL1_NUMLIG} <br/>
> </jx:forEach>
> 
> This returns a list with all the data I need.
> 
> Can someone understand what is happening here?
> 
> I'm using Cocoon 2.1.8 under win XP with Tomcat 5.5 and SUN JDK 1.5

When you say "array"... what exactly is the lines object?  A true Java
Array?  A JavaScript array you created in flowscript?  Something else?

In my experience JXPath expressions are more flexible in the kinds of
objects they know how to traverse, compared to Jexl expressions.  Try:
#{account/payer/lines[6]/CL1data/CL1_NUMLIG} and see if it has any
better luck.  Keep in mind [n] indexes in XPath are 1-based.

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