cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jan Harms" <jan.ha...@vivai.de>
Subject JXTemplateGenerator: strange behaviour with jx:set
Date Thu, 13 May 2004 13:38:36 GMT
Hi,

I just found out that jx:set does not quite behave like I expected. Please consider the following
JXTemplate snippets:

<!-- 1 -->
<element attr="${request.getAttribute('foo')}"/>

<!-- 2 -->
<jx:set var="foo" value="${request.getAttribute('foo')}"/>            
<element attr="${foo}"/>

1 and 2 should be equivalent, shouldn't they? Everything is fine as long as the request attribute
'foo' is available. However, if this is not the case (i.e. request.getAttribute('foo') evaluates
to null) then the first snippet is transformed into 

<element attr="" />

while the latter is transformed into

<element attr="[Lorg.w3c.dom.Node;@6e3dee" />

Am I doing something wrong? Or is this a bug? I couldn't find anything about it in the mail
archives.

I could imagine that the JXTemplateGenerator uses an empty DOM-Node as some kind of NullObject-Pattern.
This would work inside xml element nodes (i.e. <element>${foo}</element> works
fine in the second example), but would fail inside attributes. 

Any ideas?

Regards,

Jan Harms

P.S. I use cocoon 2.1.4.

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


Mime
View raw message