D'oh! So I can do this in jxtemplate after all.. I seem to have called the function with object.getText("something") instead of
object.getText('something') the first time I tried.


However, I do think the cocoon jxtemplate doc (http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html) should state explicitly that you can call functions of objects, not just variables... ah well.

-thomas




[EMAIL PROTECTED] wrote:



You can also access functions in a JXTemplate.

For example: <jx:forEach var="header"
items="${session.getAttribute('headers')}">

Take a look at the JXPath doc:   http://jakarta.apache.org/commons/jxpath/

Regards,
Andreas Schilling





Thomas Kjeldahl Nilsson An: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Kopie: Thema: Tricky question (?) re. JXTemplate accessing object functions, not values 14.06.2004 13:48 Bitte antworten an users




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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to