Right, I see now what you're saying and why my answer is not of any help :-)
Yes, it's entirely determined by the EL.   Have you tried reading
through the unified EL spec to see if there's anything helpful in
there?   I suspect entity[field] works more by accident than by
design.

On 3/20/07, r.stranders <[EMAIL PROTECTED]> wrote:

Your code is correct. I would like to generalize accessing the properties of
an entity by with facelets using a construct like #{contact[name]} or
#{contact[address.street]}. The former works, the latter gives an exception.
I don't think this has anything to do with facelets.


Mike Kienenberger wrote:
>
> How would you do it if there were no facelets tag involved?
>
> In my own code, it's #{contact.address.street} --
> Contact.getAddress().getStreet().
>
> Without knowing your datastructure, we can't give you an answer.
>
>
> On 3/20/07, r.stranders <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>> I've got a generic facelet for outputting attributes of an entity called
>> outputField.xhtml. Its definition:
>> <ui:composition>
>>     ...
>>     <h:outputText value="#{entity[fieldName]}" />
>> </ui:composition>
>>
>> Example usage: <outputField entity="contact" fieldName="firstName" />
>>
>> However, the entity "contact" also has an composite attribute "address"
>> which has attributes itself. However when I try: <outputField
>> entity="contact" fieldName="address.street" />. I get an exception. Any
>> idea
>> how I can access the nested bean in this generic way? (i.e.
>> entity[fieldName])?
>> --
>> View this message in context:
>> http://www.nabble.com/Navigate-nested-beans-tf3436593.html#a9581797
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
>
>

--
View this message in context: 
http://www.nabble.com/Navigate-nested-beans-tf3436593.html#a9582492
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Reply via email to