jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: [jsr372-experts mirror] StateHelper inside Repeat

From: Cagatay Civici <cagatay.civici_at_gmail.com>
Date: Tue, 24 Feb 2015 16:19:26 +0200

That would be great.

Cagatay Civici
PrimeFaces Lead
PrimeTek Informatics
www.primefaces.org


On Tuesday 24 February 2015 at 16:12, Kito Mann wrote:

> I wonder if a simple helper method that uses the clientId internally might help:
>
> getStateHelper().putIterableValue("mystate", somevalue);
>
> Not a good name, but you get the idea.
>
> ___
>
> Kito D. Mann | @kito99 | Author, JSF in Action
> Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and consulting
> http://www.JSFCentral.com | @jsfcentral
> +1 203-998-0403
>
> * Listen to the Enterprise Java Newscast: http:// (http://blogs.jsfcentral.com/JSFNewscast/)enterprisejavanews.com (http://ww.enterprisejavanews.com)
> * JSFCentral Interviews Podcast: http://www.jsfcentral.com/resources/jsfcentralpodcasts/
> * Sign up for the JSFCentral Newsletter: http://oi.vresp.com/?fid=ac048d0e17
> On Tue, Feb 24, 2015 at 9:05 AM, Cagatay Civici <cagatay.civici_at_gmail.com (mailto:cagatay.civici_at_gmail.com)> wrote:
> > Hi,
> >
> > When a component uses state map via stateHelper a problem occurs in case the component is inside Data iteration.
> >
> > For example there is a data iteration with ui:repeat from 0 to 9, comp keeps “mystate” in state helper in first index which is 0, for all other iterations from 1 to 9 “mystate” will be same.
> >
> > getStateHelper().put(“mystate”, somevalue);
> >
> > <ui:repeat>
> > <my:comp />
> > </ui:repeat>
> >
> > Can’t the JSF runtime create a unique state map using client id of the my:comp? So that the component can have a separate state map when we try to put and get from the map.
> >
> > Or would you suggest setting the state value using client id like;
> >
> > getStateHelper().put(this.clientId + “mystate”, somevalue);
> >
> > Regards,
> >
> > Cagatay Civici
> > PrimeFaces Lead
> > PrimeTek Informatics
> > www.primefaces.or (http://www.primefaces.or)
> >
> >
>
>
>