users@javaserverfaces-spec-public.java.net

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

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

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