Hi<br><br>Yes, I know this too. In few words, all &quot;transient&quot; properties, that means, <br>all properties that are not stored in the state are not saved. There are very<br>few examples. To solve this one, there are multiple alternatives. I was thinking<br>
on extend StateHelper interface to add some methods like <br>putTransientProperty and getTransientProperty. Trinidad stores all properties<br>on the FacesBean object. <br><br>Anyway, I think an &quot;mixed&quot; solution could solve this problem: create an <br>
interface called RowStateTransientHolder, so only the components that <br>implements this type of attributes could have the chance to<br>save and restore its state.<br><br>But note in any case, it is necessary to do something like this to solve the<br>
use case described.<br><br>I didn&#39;t knew that localValueSet was a transient property too.<br><br>regards,<br><br>Leonardo Uribe<br><br><div class="gmail_quote">2010/3/19 Alexander Smirnov <span dir="ltr">&lt;<a href="mailto:asmirnov@exadel.com">asmirnov@exadel.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">I&#39;ve thought about these problems for a long time too. Your proposal has<br>
a disadvantage because per-row state is quite different from the<br>
component state. Take a look for the UIInput implementation:<br>
localValueSet field is never saved in the state while it should be vary<br>
from row to row. The same thing happens to the UIForm.submitted<br>
attribute, that has been eventually added to the UIData spec instead of<br>
common solution, that would save/restore all local variables. My<br>
proposal was a separate RowStateHolder interface with<br>
save/restoreRowState methods there component developer can preserve<br>
internal variables. In the your stenario, there should be some flag that<br>
tells component to save all values, even these that are not supposed to<br>
be preserved between requests.<br>
<div><div></div><div class="h5"><br>
On 03/19/2010 10:27 AM, Leonardo Uribe wrote:<br>
&gt; In short, this topic is an attempt to add full state to components<br>
&gt; inside UIData. I&#39;ll do a brief resume, so people can understand this one<br>
&gt; easily.<br>
&gt;<br>
&gt; UIData uses the same component instances to render multiple rows.<br>
&gt; Suppose this example:<br>
&gt;<br>
&gt; &lt;h:dataTable id=&quot;cities&quot; var=&quot;city&quot; value=&quot;#{country.cities}&quot;&gt;<br>
&gt;     &lt;h:column&gt;<br>
&gt;         &lt;h:outputText value=&quot;#{city}&quot;  /&gt;<br>
&gt;     &lt;/h:column&gt;<br>
&gt; &lt;/h:dataTable&gt;<br>
&gt;<br>
&gt; In the component tree it is created this hierarchy:<br>
&gt;<br>
&gt; HtmlDatatable<br>
&gt;   UIColumn<br>
&gt;     HtmlOutputText<br>
&gt;<br>
&gt; If we have 10 cities, the same component is used over and over to render<br>
&gt; all 10 cities. The reason to do that in this way is keep state as small<br>
&gt; as possible.<br>
&gt;<br>
&gt; Now let&#39;s suppose something like this:<br>
&gt;<br>
&gt; &lt;h:dataTable id=&quot;cities&quot; var=&quot;city&quot; value=&quot;#{country.cities}&quot;&gt;<br>
&gt;     &lt;h:column&gt;<br>
&gt;         &lt;h:inputText value=&quot;#{city}&quot;  /&gt;<br>
&gt;     &lt;/h:column&gt;<br>
&gt; &lt;/h:dataTable&gt;<br>
&gt;<br>
&gt; It was changed the output component for an input one. If this table is<br>
&gt; in a form and the values are submitted, the same component is used to<br>
&gt; apply request values, validate and apply them to the model (update<br>
&gt; process). To make this possible, UIData class has some code to preserve<br>
&gt; this values between phases (using EditableValueHolder interface), so<br>
&gt; when each phase is processed, all rows are traversed and you get the<br>
&gt; expected behavior.<br>
&gt;<br>
&gt; Now suppose something more complex: We have a code that use<br>
&gt; invokeOnComponent to change the style of my inputText. In theory, only<br>
&gt; one row should change. But in fact, all rows are rendered with the same<br>
&gt; color. Why? because we use the same component to render all rows, and we<br>
&gt; don&#39;t preserve the children component state between rows.<br>
&gt;<br>
&gt; There is a lot of issues, questions, and side effects related to this<br>
&gt; issue, but just to put some of them here:<br>
&gt;<br>
&gt; TOMAHAWK-1062 InputTextArea doesn&#39;t work properly inside facet DetailStamp<br>
&gt; TOMAHAWK-96 Data table Scroller not working the dataTable which was<br>
&gt; actually contained in other DataTable<br>
&gt; <a href="https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=153" target="_blank">https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=153</a><br>
&gt; Problems with UIData state saving<br>
&gt;<br>
&gt; Also, it is well know that one reason why people uses c:forEach in<br>
&gt; facelets, is because this one create &quot;full&quot; components per each row. It<br>
&gt; is very easy to find articles on internet.<br>
&gt;<br>
&gt; Now, with jsf 2.0 we have partial state saving, so we have a chance to<br>
&gt; fix this one once and for all. I tried fix this one per months (maybe<br>
&gt; years!), but talking with Martin Marinschek on JSFDays, some ideas came<br>
&gt; out and finally it was found a possibility to fix this one using the<br>
&gt; existing api and with little changes on the spec.<br>
&gt;<br>
&gt; The proposal is this:<br>
&gt;<br>
&gt; 1. Do not call UIComponent.markInitialState() on<br>
&gt; ComponentTagHandlerDelegate, as ComponentHandler javadoc says, instead<br>
&gt; call it after PostAddToViewEvent are published on vdl.buildView(). We<br>
&gt; need to call it from root to nodes, so the parent component is marked<br>
&gt; first. I know the place where this call comes is from trinidad tag<br>
&gt; handler, but this call needs to be fixed in a more predictable way.<br>
&gt; 2. Use an attribute on facesContext to identify when the VDL is marking<br>
&gt; the initial state (in myfaces there is already an attribute called<br>
&gt; &quot;org.apache.myfaces.MARK_INITIAL_STATE&quot;). This is necessary to indicate<br>
&gt; UIData instances that it is time to save the full state of all component<br>
&gt; children,<br>
&gt; 3. Allow UIData to hold a map where the key are client ids and the value<br>
&gt; are the deltas of all components per row. This map should be saved and<br>
&gt; restored.<br>
&gt; 4. Change UIData.setRowIndex() to restore and save the component state.<br>
&gt;<br>
&gt; I&#39;ll attach a patch on myfaces issue tracker with the algorithm proposed<br>
&gt; (because it is based on myfaces codebase). It was tested and it works.<br>
&gt; But note it is necessary to fix the javadoc for<br>
&gt; UIData.markInitialState(), ComponentHandler and maybe vdl.buildView(),<br>
&gt; so the intention is propose this change for jsf 2.0 rev A. Note this<br>
&gt; works only with PSS enabled because without it we don&#39;t have a place to<br>
&gt; notify UIData instances that it is necessary to get the full state.<br>
&gt; Also, note this patch preserve backward compatibility, because the old<br>
&gt; way to store/save is applied after the full state is restored.<br>
&gt;<br>
&gt; Really, I have the strong temptation to apply some similar code on<br>
&gt; myfaces UIRepeat component (because this class is private), but I prefer<br>
&gt; first ask to EG to know what you guys think about it.<br>
&gt;<br>
&gt; Suggestions are welcome,<br>
&gt;<br>
&gt; regards,<br>
&gt;<br>
&gt; Leonardo Uribe<br>
&gt;<br>
</div></div></blockquote></div><br>