You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "R. Müller" <r....@unicomp-berlin.de> on 2005/12/08 09:09:57 UTC

init backing bean on page request

hi group,

i have backing bean, which provides data for datatable.
i want display this table on two different pages with different 
properties; in my case just different count of rows.
how can i initialize the backing bean depending on the requested page 
i.e. just setting some values.
is something possible like JSTLs <c:set ... /> ?

regards

ronald

-- 
*********************************************************
*M-Unicomp GmbH
*
*Ronald Müller
*
*Plauener Straße 163-165, Haus 11
*13053 Berlin
*
*fon   : +49 ( 0 ) 30  / 98 69 61 54
*mobil : +49 ( 0 ) 172 / 93 95 00 4
*fax   : +49 ( 0 ) 30  / 98 69 61 55
*email : r.mueller@unicomp-berlin.de
*web   : www.unicomp-berlin.de
********************************************************

Re: init backing bean on page request [solved]

Posted by "R. Müller" <r....@unicomp-berlin.de>.
I found a feasible (but not nice) solution for this using <t:aliasBean> 
and  <t:aliasBeanScope>. i think it is quite similiar to wiki-examples:

faces-config.xml

<managed-bean>
	<managed-bean-name>list00</managed-bean-name>
	<managed-bean-class>ItemList</managed-bean-class>
	<managed-bean-scope>request</managed-bean-scope>
	<managed-property>
     		<property-name>msgPerPage</property-name>
	    	<value>10</value>
	</managed-property>
</managed-bean>

<managed-bean>
	<managed-bean-name>list01</managed-bean-name>
	<managed-bean-class>ItemList</managed-bean-class>
	<managed-bean-scope>request</managed-bean-scope>
	<managed-property>
     		<property-name>msgPerPage</property-name>
		<value>20</value>
	</managed-property>
</managed-bean>

page1.jsp

<t:aliasBeansScope>
<t:aliasBean alias="#{list}" value="#{list00}"/>
	<jsp:include page="/list.jsp" />
</t:aliasBeansScope>


page2.jsp

<t:aliasBeansScope>
<t:aliasBean alias="#{list}" value="#{list01}"/>
	<jsp:include page="/list.jsp" />
</t:aliasBeansScope>


list.jsp

[...]

<t:datatable value="#{list.itemList}" .... >
	[...]
</t:datatable>




R. Müller wrote:
> hi group,
> 
> i have backing bean, which provides data for datatable.
> i want display this table on two different pages with different 
> properties; in my case just different count of rows.
> how can i initialize the backing bean depending on the requested page 
> i.e. just setting some values.
> is something possible like JSTLs <c:set ... /> ?
> 
> regards
> 
> ronald
>