On 1/3/06, Marco Mistroni <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >