cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Kjeldahl Nilsson ...@marcello.no>
Subject Re: Tricky question (?) re. JXTemplate accessing object functions, not values
Date Tue, 15 Jun 2004 09:15:56 GMT

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




aschilling@s-und-n.de 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:      users@cocoon.apache.org     
                                                  
>                       <tn@marcello.no>         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: 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
> 
> 
> 


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


Mime
View raw message