You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marco Mistroni <mm...@waersystems.com> on 2006/01/03 10:35:05 UTC
OT/ JSF & Indexed properties
Hello all,
Sorry for the OT ... I was wondering, for anyone who has switched
>From struts to JSF, how have you dealt with indexed properties?
I am currently using MyFaces, and looks like I have an usecase in which
I need to use indexed properties..
I was told that JSF does not support htat... are there any workarounds?
Basically, I'd need in my jsf page something like this
<t:inputText value="#{savingsBean.amounts[0]}"/>
Anyone has any suggestions?
Thanks and regards
marco
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: OT/ JSF & Indexed properties
Posted by Craig McClanahan <cr...@apache.org>.
On 1/3/06, Marco Mistroni <mm...@waersystems.com> wrote:
>
> Hello all,
> Sorry for the OT ... I was wondering, for anyone who has switched
> From struts to JSF, how have you dealt with indexed properties?
> I am currently using MyFaces, and looks like I have an usecase in which
> I need to use indexed properties..
> I was told that JSF does not support htat... are there any workarounds?
>
>
> Basically, I'd need in my jsf page something like this
>
> <t:inputText value="#{savingsBean.amounts[0]}"/>
>
>
> Anyone has any suggestions?
The general JSF approach would be to use a component that does the iteration
over a list, rather than embedding the iteration in your JSP page. For
example, you might use a table component bound to the entire array:
<h:dataTable ... value="#{savingsBean.accounts}" var="current">
...
<h:column>
<h:inputText ... value="#{current.amount}"/>
</h:column>
...
</h:dataTable>
The table would be bound to an array of account beans, and (as it iterates)
exposes the account bean for the current row in a request attribute named
"current". Inside a column, you can bind components to a property of the
current row's account bean, and the table component deals with all the
looping and indexing for you.
Thanks and regards
> marco
Craig
---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>