myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Gavazuk" <antongava...@gmail.com>
Subject Re: Composite view from several "request" managed beans
Date Wed, 20 Aug 2008 12:44:47 GMT
Ok, somehow out of scope but

very popular topic :) - send an parameter (for example in CRUD - send
an ID from list to view/edit screen)

my approach:

ManagedBean has getter for list and particular class field for list

so when edit action is executed I'm able to ask:

this.list.getRowData() - and I get the an object, and can ask in this
object for some distinct value, like id.

and also if I want to link 2 different managed bean (like person -
address relation)

I use <tm:updateActionListener property="#{entity}" value="#{entity2.entity}"/>

and
<bean>entity2</bean>
<managed-property>
			<property-name>entity</property-name>
			<value>#{ManagedBean for entity}</value>
		</managed-property>

Its all desribed in MyFaces WiKi, but maybe also will help someone.



2008/8/20 Anton Gavazuk <antongavazuk@gmail.com>:
> Hi Volker,
>
> I'm already using this approach (by the way, its deprecated in 1.2)
> I'm just interested if someone faces with the same situation and how
> to solve it.
>
> 2008/8/20 Volker Weber <v.weber@inexso.de>:
>> Hi Anton,
>>
>> 2008/8/20 Anton Gavazuk <antongavazuk@gmail.com>:
>>> Hi Guy,
>>>
>>> thanks for answer
>>>
>>>>>All necessary beans will be instantiated automatically by JSF as long
as you
>>>>>define them in your faces-config.xml file.
>>> its clear,
>>> but I want to put some business related info in bean before showing them.
>>> like following
>>> JSF method {
>>
>> if you do here:
>>  SomeBean  = facesContext.getApplication().getVariableResolver().resolveVariable(facesContext,
>> "someBean");
>> instead of
>>> SomeBean = new SomeBean();
>>
>> it should work if you have "someBean" configured in faces-config.xml
>>
>>>  SomeBean.value1 =     Service.getSomething();
>>>  SomeBean.value2 =     Service.getSomething();
>>>
>>>  SomeBean2 = new SomeBean2();
>>> .....
>>>  //now I can add these beans to faces context of course, but maybe
>>> there is another way?
>>> }
>>>
>>> I dont want to call business functions inside getters of managed beans.
>>>
>>>
>>> 2008/8/20 Guy Bashan <guy.bashan@gmail.com>:
>>>> Hi,
>>>>
>>>> You can simply call all the beans directly from your JSP file.
>>>> For example:
>>>>
>>>> <h:dataTable value="myFirstBean.someData" .../>
>>>> <h:dataTable value="mySecondBean.someOtherData" .../>
>>>>
>>>> And so on...
>>>>
>>>> All necessary beans will be instantiated automatically by JSF as long as
you
>>>> define them in your faces-config.xml file.
>>>>
>>>> Guy.
>>>>
>>>> -----Original Message-----
>>>> From: Anton Gavazuk [mailto:antongavazuk@gmail.com]
>>>> Sent: Wednesday, August 20, 2008 11:33 AM
>>>> To: MyFaces Discussion
>>>> Subject: Composite view from several "request" managed beans
>>>>
>>>> Hi all,
>>>>
>>>> have maybe a silly question
>>>>
>>>> if I need to show a page which consists from several parts (modules)
>>>> with different info, and this info cannot be stored in session beans,
>>>> it should be refreshed on every request, so there is need for several
>>>> managed beans with request scope.
>>>>
>>>> So if request forwards on such "composite"  page, should I create and
>>>> put this beans in context manually in an JSF method or there is
>>>> another way how to achieve this?
>>>>
>>>> Many thanks,
>>>> Anton
>>>>
>>>>
>>>
>>
>>
>>
>> --
>> inexso - information exchange solutions GmbH
>> Bismarckstra├če 13 | 26122 Oldenburg
>> Tel.: +49 441 4082 356 |
>> FAX: +49 441 4082 355 | www.inexso.de
>>
>

Mime
View raw message