myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hazem Saleh" <hazem.sa...@gmail.com>
Subject Re: index properties and JSF
Date Sun, 10 Dec 2006 20:09:09 GMT
Hi,
In JSF 1.2 you can easily make something like that by referring to the
current item using the EL.
See that example here :
http://www.jroller.com/page/HazemBlog?entry=my_first_glance_at_jsf
Thanks
On 12/10/06, Simon Kitching <simon.kitching@rhe.co.nz> wrote:
> Charbel Abdul-Massih wrote:
> > What's the best way to handle index properties in JSF…
> >
> >
> >
> > I have a <c:foreach> loop inside of which I display a text input box
> > that can be edited…When I hit submit, how does JSF know which text input
> > box to map to which index of the array in the backing bean???
> >
> >
> >
> > The JSF code goes like this:
> >
> >
> >
> > <c:forEach items="#{bean.phones}" var="phone">
> >
> >      <h:inputText value="#{x.phoneValue}>
> >
> > </c:forEach>
> >
> >
> >
> > The backing bean has a member variable called phones of type ArrayList.
> > The ArrayList is an array of an internal object called Phone…
> >
> > The question is when the phone values are edited on the screen and
> > submit is hit, how does JSF know which value to map to which index in
> > the backing bean array???
>
> The c:forEach and c:if statements do not integrate at all well with JSF
> (at least JSF 1.1; not sure about v1.2).
>
> Use a t:dataList instead. This component then provides a "var" variable
> that can be used to access "the component currently being processed".
>
> The t:dataList also provides a "rowIndexVar" variable that can be used
> to index into the "value" data list, though this is less elegant.
>
> http://myfaces.apache.org/tomahawk/tlddoc/t/dataList.html
>
> Regards,
>
> Simon
>


-- 
Hazem Ahmed Saleh Ahmed
IBM Egypt Cairo TDC ( Technology Development Center )
WebSphere Business Integration Modeler Software Engineer
http://www.jroller.com/page/HazemBlog

Mime
View raw message