2 Replies Latest reply on Apr 12, 2008 9:13 AM by Martin Trummer

    Partial page reponse

    Martin Trummer Newbie

      Hi.

      I've created a simple page using richfaces 3.2.0 with Seam 2.0.

      <a4j:form>
       <a4j:region renderRegionOnly="true" >
       <a4j:commandButton value="Add item"
       reRender="table"
       action="#{DataBean.addNewItem('test1', 'test2')}" />
       </a4j:region>
      </a4j:form>
      <rich:dataTable value="#{DataBean.items}" var="item" id="table">
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Column 1" />
       </f:facet>
       <h:outputText value="#{item.column1}" />
       </rich:column>
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Column 2" />
       </f:facet>
       <h:outputText value="#{item.column2}" />
       </rich:column>
      </rich:dataTable>
      


      Now I have two questions:
      1) I used firebug to look at the response of the ajax request (after hitting the commandButton) and then I noticed that the whole page is returned in the response. I hoped that only the table will be within the response...
      2) If I remove the reRender attribute from the commandButton and hit this button the DataBean.getItems() method is called? Why?


        • 1. Re: Partial page reponse
          Martin Trummer Newbie

          I can answer the first question myself. The answer is that I'm not right and not the whole page is contained within the response. I was confused because the response contains the html header data...


          <?xml version="1.0"?>
          <html xmlns="http://www.w3.org/1999/xhtml"><head><title></title><link type="text/css" rel="stylesheet"
          href="/PickListExample/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAHblDspFQAFnAIX"
          class="component" /><link type="text/css" rel="stylesheet" href="/PickListExample/a4j_3_2_0-SNAPSHOTorg
          /richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAHblDspFQAFnAIX" class="component" /><link
          type="text/css" rel="stylesheet" href="/PickListExample/a4j_3_2_0-SNAPSHOTcss/toolBar.xcss/DATB/eAHblDspFQAFnAIX"
          class="component" /><link type="text/css" rel="stylesheet" href="/PickListExample/a4j_3_2_0-SNAPSHOTcss
          /table.xcss/DATB/eAHblDspFQAFnAIX" class="component" /><script type="text/javascript" src="/PickListExample
          /a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript">
          </script><script type="text/javascript" src="/PickListExample/a4j_3_2_0-SNAPSHOTorg/ajax4jsf/javascript
          /scripts/form.js">
          </script><script type="text/javascript" src="/PickListExample/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript
          .PrototypeScript">
          </script><script type="text/javascript" src="/PickListExample/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit
          /html/scripts/data-table.js">
          </script></head><body><span id="table"><table class="dr-table rich-table" id="j_id15" border="0" cellpadding
          ="0" cellspacing="0"><colgroup span="2"></colgroup><thead class="dr-table-thead"><tr class="dr-table-subheader
          rich-table-subheader"><th class="dr-table-subheadercell rich-table-subheadercell" scope="col" id="j_id15
          :2:j_id16header"><div id="j_id15:2:j_id16header:sortDiv">Column 1</div></th><th class="dr-table-subheadercell
          rich-table-subheadercell" scope="col" id="j_id15:2:j_id19header"><div id="j_id15:2:j_id19header:sortDiv"
          >Column 2</div></th></tr></thead><tbody id="j_id15:tb"><tr class="dr-table-firstrow rich-table-firstrow"
          ><td class="dr-table-cell rich-table-cell" id="j_id15:0:j_id16">abc</td><td class="dr-table-cell rich-tale-cell"
          id="j_id15:0:j_id19">xyz</td></tr><tr class="dr-table-firstrow rich-table-firstrow"><td class="dr-table-cell
          rich-table-cell" id="j_id15:1:j_id16">123</td><td class="dr-table-cell rich-table-cell" id="j_id15:1
          :j_id19">456</td></tr><tr class="dr-table-firstrow rich-table-firstrow"><td class="dr-table-cell rich-table-cell"
          id="j_id15:2:j_id16">test1</td><td class="dr-table-cell rich-table-cell" id="j_id15:2:j_id19">test2
          </td></tr><tr class="dr-table-firstrow rich-table-firstrow"><td class="dr-table-cell rich-table-cell"
          id="j_id15:3:j_id16">test1</td><td class="dr-table-cell rich-table-cell" id="j_id15:3:j_id19">test2
          </td></tr></tbody></table></span><meta name="Ajax-Update-Ids" content="table,j_id15:2:j_id16header:sortDiv
          ,j_id15:2:j_id19header:sortDiv" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState"
          id="javax.faces.ViewState" value="j_id5" /></span><meta id="Ajax-Response" name="Ajax-Response" content
          ="true" /></body></html>


          But still I have no clue why the getter is called when removing the reRender attribute.

          • 2. Re: Partial page reponse
            Martin Trummer Newbie

            Damn, quote was not the correct one...
            Once again here is the response I'm talking about...

            <?xml version="1.0"?>
            <html xmlns="http://www.w3.org/1999/xhtml"><head><title></title><link type="text/css" rel="stylesheet"
             href="/PickListExample/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAHblDspFQAFnAIX"
             class="component" /><link type="text/css" rel="stylesheet" href="/PickListExample/a4j_3_2_0-SNAPSHOTorg
            /richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAHblDspFQAFnAIX" class="component" /><link
             type="text/css" rel="stylesheet" href="/PickListExample/a4j_3_2_0-SNAPSHOTcss/toolBar.xcss/DATB/eAHblDspFQAFnAIX"
             class="component" /><link type="text/css" rel="stylesheet" href="/PickListExample/a4j_3_2_0-SNAPSHOTcss
            /table.xcss/DATB/eAHblDspFQAFnAIX" class="component" /><script type="text/javascript" src="/PickListExample
            /a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript">
            </script><script type="text/javascript" src="/PickListExample/a4j_3_2_0-SNAPSHOTorg/ajax4jsf/javascript
            /scripts/form.js">
            </script><script type="text/javascript" src="/PickListExample/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript
            .PrototypeScript">
            </script><script type="text/javascript" src="/PickListExample/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit
            /html/scripts/data-table.js">
            </script></head><body><span id="table"><table class="dr-table rich-table" id="j_id15" border="0" cellpadding
            ="0" cellspacing="0"><colgroup span="2"></colgroup><thead class="dr-table-thead"><tr class="dr-table-subheader
             rich-table-subheader"><th class="dr-table-subheadercell rich-table-subheadercell" scope="col" id="j_id15
            :2:j_id16header"><div id="j_id15:2:j_id16header:sortDiv">Column 1</div></th><th class="dr-table-subheadercell
             rich-table-subheadercell" scope="col" id="j_id15:2:j_id19header"><div id="j_id15:2:j_id19header:sortDiv"
            >Column 2</div></th></tr></thead><tbody id="j_id15:tb"><tr class="dr-table-firstrow rich-table-firstrow"
            ><td class="dr-table-cell rich-table-cell" id="j_id15:0:j_id16">abc</td><td class="dr-table-cell rich-tale-cell"
             id="j_id15:0:j_id19">xyz</td></tr><tr class="dr-table-firstrow rich-table-firstrow"><td class="dr-table-cell
             rich-table-cell" id="j_id15:1:j_id16">123</td><td class="dr-table-cell rich-table-cell" id="j_id15:1
            :j_id19">456</td></tr><tr class="dr-table-firstrow rich-table-firstrow"><td class="dr-table-cell rich-table-cell"
             id="j_id15:2:j_id16">test1</td><td class="dr-table-cell rich-table-cell" id="j_id15:2:j_id19">test2
            </td></tr><tr class="dr-table-firstrow rich-table-firstrow"><td class="dr-table-cell rich-table-cell"
             id="j_id15:3:j_id16">test1</td><td class="dr-table-cell rich-table-cell" id="j_id15:3:j_id19">test2
            </td></tr></tbody></table></span><meta name="Ajax-Update-Ids" content="table,j_id15:2:j_id16header:sortDiv
            ,j_id15:2:j_id19header:sortDiv" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState"
             id="javax.faces.ViewState" value="j_id5" /></span><meta id="Ajax-Response" name="Ajax-Response" content
            ="true" /></body></html>