cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Boksa <>
Subject [2.2] Accessing static methods in JX Templates
Date Fri, 15 Aug 2008 23:21:06 GMT
Hi List,

at the moment I am working on a simple template to output a list of  
some arbitrary beans including their properties. To do this I would  
like to use PropertyUtil.describe(java.lang.Object bean) [1].

However there seems to be some problem when I try to access  
PropertyUtils within the template (where bean is set by jx:forEach).

    <jx:set var="beanMap" value="$ 
    <jx:out value="${beanMap}"/>

The construct runs without an error but does not output anything. Is  
this the correct behaviour or did I run into a bug?

For now I am using the following workaround (the template is called  
from flowscript)



    cocoon.sendPage("foo", {
       "beanList"	: list,
       "PropertyUtils"	: cocoon.createObject(PropertyUtils)

and accordingly in the template:

    <jx:set var="beanMap" value="${PropertyUtils.describe(bean)}"/>
    <jx:out value="${beanMap}"/>

which outputs a map of the Bean's properties as expected.

As you might imagine I am absolutely not happy with this workaround.  
Is there any better solution or a fix to the issue mentioned above? If  
you need to know more information just let me know. I am looking  
forward to your answers.

Thanks in advance



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message