8 Replies Latest reply on Jan 10, 2008 2:05 PM by sergeysmirnov

    Render Response overhead in RichFaces?

    toby_cool

      Hello!

      I'm quite new to JSF and RichFaces but I'm now evaluating both JSF and RichFaces to possibly use it for an application.

      It seems to me that when using RichFaces the whole page is rendered in the "Render Response" phase even though only a small piece of the page is changed using ajax. Isn't that a big overhead on the server? I guess only the part that is in the reRender tag is sent back to the client but don't you also want as little work as possible on the server when using ajax.

      Thankful for comments about this!

      /Toby

        • 1. Re: Render Response overhead in RichFaces?

          Why do you decide that RichFaces render the whole page?

          • 2. Re: Render Response overhead in RichFaces?
            toby_cool

            I do the following:

            I have a page containing a table that gets its values from a list in a backing bean. Then I do a simple update of another part of the page by pushing a button that rerenders a label next to the button. If I then put a breakpoint on the getTableList()-method which returns the list that is mapped to the table in the page, I see that the method is called even though the table isn't involved in the request.

            Is the conclusion that the table is rendered on the server even though it's not part of the request wrong?

            • 3. Re: Render Response overhead in RichFaces?

              What the phase of the JSF lifecycle this method is invoked on?

              • 4. Re: Render Response overhead in RichFaces?
                toby_cool

                The method getTableList() is invoked in the "Render Response" phase. Doesn't this mean that the whole page is rerendered even though it's unnecessary?

                • 5. Re: Render Response overhead in RichFaces?

                  First of, if getTableList() is invoked it does not mean that the whole page is rendered. It does not mean that the whole table is rendered, even.

                  Post the code snippet of the page for further explanations, please. What is the scope of the bean for tableList property? Which component is a source for Ajax request? Does the action method is used? if so, what it returns?

                  • 6. Re: Render Response overhead in RichFaces?
                    toby_cool

                    Here comes some code to illustrate my example:

                    <rich:dataTable value="#{backing.employees}" var="emp" columns="3"
                     id="employeeTable">
                     <f:facet name="header">
                     <rich:columnGroup>
                     <rich:column>
                     <h:outputText value="#{sal['employees.table.employeeid']}"></h:outputText>
                     </rich:column>
                     <rich:column>
                     <h:outputText value="#{sal['employees.table.firstname']}"></h:outputText>
                     </rich:column>
                     <rich:column>
                     <h:outputText value="#{sal['employees.table.lastname']}"></h:outputText>
                     </rich:column>
                     </rich:columnGroup>
                     </f:facet>
                     <rich:column>
                     <h:outputText value="#{emp.id}"></h:outputText>
                     </rich:column>
                     <rich:column>
                     <h:outputText value="#{emp.firstName}"></h:outputText>
                     </rich:column>
                     <rich:column>
                     <h:outputText value="#{emp.lastName}"></h:outputText>
                     </rich:column>
                     </rich:dataTable>
                     <a4j:region renderRegionOnly="true">
                     <a4j:form>
                     <a4j:commandButton value="Update label"
                     action="#{backing.setNewLabel}" reRender="label"></a4j:commandButton>
                     <h:outputText id="label" value="#{backing.label}"></h:outputText>
                     </a4j:form>
                     </a4j:region>


                    In the code above I don't have the problem of the server rendering the whole page when pushing the commandButton. I found that using the renderRegionOnly attribute of the a4j:region-tag only renders the region.

                    I thought from the start that the reRender attribute could specify what's beeing rendered on the server as well. I guess that's not the case. So without the a4j:region in the page the whole page is rendered on the server even though i only want to uptate a small outputtext.

                    • 7. Re: Render Response overhead in RichFaces?
                      ilya_shaikovsky

                      Works as designed. renderRegionOnly="false" by default allows to decode apply and process only the region but update any components outside the region. So components outside the region isn't processed but could be updated while reRendering. With true value encoding also limited.

                      • 8. Re: Render Response overhead in RichFaces?

                        Toby, the rendering in JSF has the particular definition. Shortly, it is process to create an output (for example, html markup) based on the component tree.
                        In your case, the table if NOT rendered. It is not rendered even renderRegionOnly = false.

                        RichFaces walks through the component tree finding for the components need to be rerendered. dataTable might have children. So, RichFaces finds inside the table. This is a reason why getter is invoked. However, RichFaces is only walking though the table, but not renders it.

                        The same getter should be invoked on the first JSF phase as well. So, if you drop the result of that invocation and perform it again (for example, ask the database), this causes the performance. However, if you do so, it is your fault from the architectural point of view.

                        Why it is a different if renderRegionOnly="true". It means "do not need to find the components for rerendering outside of this region".

                        The size of the rendered code (code that is transfered to the client) with be the same in both cases.