title: Rendering other form by ajax causes its view state to be lost, how do I add this back?
body: <p>I have </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;h:form&gt;
      &lt;h:commandLink action="#{my_fake_ajax_link}"&gt;
          &lt;h:outputText value="Link" /&gt;
          &lt;f:ajax render=":mydiv" /&gt;
      &lt;/h:commandLink&gt;
  &lt;/h:form&gt;
  
  &lt;h:panelGroup layout="block" id="mydiv"&gt;
      &lt;h:form&gt;
          &lt;h:commandLink action="#{mybean.delete(0)}"&gt;
              &lt;h:outputText value="Here" /&gt;
              &lt;f:ajax render="@form" /&gt;
          &lt;/h:commandLink&gt;
      &lt;/h:form&gt;
  &lt;/h:panelGroup&gt;
  </code></pre>
  
  <p>When I click once on "my_fake_ajax_link", then I have to click twice on "delete" link. This is only an example. I don't have this real case. I have multiple forms on a page and I can't just add all of them in a single form.</p>
  
  <p>I checked what the problem is and it is: </p>
  
  <ul>
  <li>When you click on "my_fake_ajax_link", the <code>mydiv</code> refreshs with ajax as it should.</li>
  <li>ViewState of the refreshed form on ajax is missing.</li>
  </ul>
  
  <p>How can I add the ViewState? How can I make it work without using only one form? This looks like an JSF bug to me. I don't want to refresh that div automatically with </p>
  
  <pre><code>jQuery("#mydiv").load(document.location.href);
  </code></pre>
  
  <p>but I will in my worst case possible.</p>