You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Andreas Niemeyer <an...@gutzmann.com> on 2008/10/24 12:46:52 UTC

Re: how to call a setProperty(x) method in managed bean without form action and within tag

Hi Simon,

thank you for the conceptional explanation, you are right.

I'm just relative new to JSF, therefore it's important to understand 
what you mentioned.

Regards,
Andreas


Simon Kitching schrieb:
> I think the answer is: don't do that.
> 
> The view layer is about presenting information. Having it poking values
> into your backing beans as a side-effect feels very wrong to me.
> 
> The ui:repeat tag sets up a variable for you (you call it "orga"); your
> inner loop should be just accessing properties of whatever elements the
> outer loop is iterating over.
> 
> You might find that you need to create "presentation-oriented" wrapper
> objects for your model objects and iterate over those rather than
> iterating over your model objects directly, ie the "value" property of
> the outer loop might point at a list of objects that hold related model
> objects but are not actually model objects themselves. This is quite a
> common thing to do.
> 
> Regards,
> Simon
> 
> On Thu, 2008-10-23 at 22:10 +0200, Andreas Niemeyer wrote:
>> Hi,
>>
>> Maybe this subject does better desribe what I need.
>>
>> How do I copy a bean attribute from a <repeat> tag iteration for using 
>> in the nested iteration by calling a setAttribute(Object 
>> copied_attribute) operation? How would it work, which tag could be helpful?
>>
>> Thank you for help! I havn't found the solution yet...
>>
>> Regards,
>> Andreas
>>
>>
>> Andreas Niemeyer schrieb:
>>> Hi,
>>>
>>> I would like to inject a object from a <ui:repeat> iterationinto a 
>>> setter method of the bean for a nested second iteration.
>>>
>>> The nested iteration depends on the previous object.
>>>
>>>
>>> <ui:repeat value="${userinfo.userorganisations}" var="orga">
>>>  <tr><td>organisation: </td><td>#{orga.name}</td></tr>
>>>     
>>> <!-- ???
>>>  ${userinfo.organizationobject}=${orga}
>>> -->
>>>
>>>   <ui:repeat value="${userinfo.userorganisationroles}" var="role">
>>>    <tr><td>organisation role:    </td><td>#{role}</td></tr>
>>>   </ui:repeat>
>>> </ui:repeat>
>>>
>>>
>>>
>>> I read something about the setPropertyActionListener
>>>
>>> <f:setPropertyActionListener value="#{beanx.a}" target="#{beanY.b}"/>
>>> used in the <h:commandLink>.
>>>
>>>
>>> This is nearly what I need but for the iteration construct without an 
>>> action.
>>>
>>>
>>> MTIA!
>>>
>>> Regards,
>>> Andreas
>>>
>>>
> 
>