You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jan Harms <ha...@vivai.de> on 2004/06/04 10:33:57 UTC

Bug in jx:set?

Hi list,

I recently posted the following message on the user list, but didn't 
get an answer. I believe it is a bug, and I verified that this 
behaviour is still the same with cocoon 2.1.5, so maybe one of you 
could have a quick look at it. It should be easy to reproduce.

Thanks,

Jan Harms


> Von: "Jan Harms" <ja...@vivai.de>
> Datum: 13. Mai 2004 15:38:36 MESZ
> An: <us...@cocoon.apache.org>
> Betreff: JXTemplateGenerator: strange behaviour with jx:set
>
> 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.