You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Thomas Kjeldahl Nilsson <tn...@marcello.no> on 2004/06/14 13:48:36 UTC
Tricky question (?) re. JXTemplate accessing object functions, not
values
Hey again-
Problem: I've got a java object with a 'String getText(String id)'
method. This object acts as an abstraction of a database
(the database contains text content in different languages.)
Now, what I would like to do is send this java object to the jxtemplate
generator, and in each jxtemplate access javaobject.getText(id)
directly, like this:
${javaobject.getText("Submit_btn_txt")}
Now of course this doesn't work, since the jxtemplate generator is only
able to access data directly through the variables of an object, not its
functions. (Right?)
The only other alternative I'm able to see right now is
A: constructing a java object hardcoded with all the possible getText()
element in public variables, or
B: for each jxtemplate, construct a smaller object with only the needed
subset of data variables for the current template.
Either way, not an elegant solution given a huge (and growing) database
of elements!! Any immediate thoughts\suggestions on the problem?
Regards,
Thomas Kjeldahl Nilsson
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Tricky question (?) re. JXTemplate accessing object functions,
not values
Posted by Thomas Kjeldahl Nilsson <tn...@marcello.no>.
Very quick question:
Does the Velocity generator work just as well as the JXTemplate generator?
I may end up using Velocity templates\generator instead of JXTemplate,
but I'm a bit wary of this because the Velocity generator isn't
mentioned very often in the cocoon doc.. :)
Regards,
Thomas Kjeldahl Nilsson
Nicolas Bielza wrote:
> I don't know about the JXTemplate generator, but you may want to try the
> Velocity generator which does access object methods (if they are
> public).
>
> Regards,
> Nicolas.
>
>
> -----Original Message-----
> From: Thomas Kjeldahl Nilsson [mailto:tn@marcello.no]
> Sent: 14 juin, 2004 07:49
> To: users@cocoon.apache.org
> Subject: Tricky question (?) re. JXTemplate accessing object functions,
> not values
>
>
> Hey again-
>
> Problem: I've got a java object with a 'String getText(String id)'
> method. This object acts as an abstraction of a database
> (the database contains text content in different languages.)
>
> Now, what I would like to do is send this java object to the jxtemplate
> generator, and in each jxtemplate access javaobject.getText(id)
> directly, like this:
>
> ${javaobject.getText("Submit_btn_txt")}
>
> Now of course this doesn't work, since the jxtemplate generator is only
> able to access data directly through the variables of an object, not its
>
> functions. (Right?)
>
> The only other alternative I'm able to see right now is
>
> A: constructing a java object hardcoded with all the possible getText()
> element in public variables, or
> B: for each jxtemplate, construct a smaller object with only the needed
> subset of data variables for the current template.
>
> Either way, not an elegant solution given a huge (and growing) database
> of elements!! Any immediate thoughts\suggestions on the problem?
>
>
> Regards,
> Thomas Kjeldahl Nilsson
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: Tricky question (?) re. JXTemplate accessing object functions, not values
Posted by Nicolas Bielza <ni...@alligacom.com>.
I don't know about the JXTemplate generator, but you may want to try the
Velocity generator which does access object methods (if they are
public).
Regards,
Nicolas.
-----Original Message-----
From: Thomas Kjeldahl Nilsson [mailto:tn@marcello.no]
Sent: 14 juin, 2004 07:49
To: users@cocoon.apache.org
Subject: Tricky question (?) re. JXTemplate accessing object functions,
not values
Hey again-
Problem: I've got a java object with a 'String getText(String id)'
method. This object acts as an abstraction of a database
(the database contains text content in different languages.)
Now, what I would like to do is send this java object to the jxtemplate
generator, and in each jxtemplate access javaobject.getText(id)
directly, like this:
${javaobject.getText("Submit_btn_txt")}
Now of course this doesn't work, since the jxtemplate generator is only
able to access data directly through the variables of an object, not its
functions. (Right?)
The only other alternative I'm able to see right now is
A: constructing a java object hardcoded with all the possible getText()
element in public variables, or
B: for each jxtemplate, construct a smaller object with only the needed
subset of data variables for the current template.
Either way, not an elegant solution given a huge (and growing) database
of elements!! Any immediate thoughts\suggestions on the problem?
Regards,
Thomas Kjeldahl Nilsson
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org