If you do this then the EL will never be evaluated again while the user is on this view as the newly set value will eclipse the ValueExpression and will be state saved with the view state. This is not what you want.

-- Blake Sullivan

On 8/2/10 7:23 AM, Bashirazad, Wahid wrote:
Hi,

I'm investigating some time to improve the performance of my application
at the moment. My focus is due to reduction of CPU usage. I noticed that
the method isRendered() of every UICompoment is called 3 times in the
RenderResponse phase (MyFaces 1.2.8). This means 3 executions of the
expensive ELExpressions. My question is, why not to call setRenderd() on
the UIComponent after the first execution?

In org.apache.myfaces.shared_impl.renderkit.RendererUtils class I
changed the Method renderChildren() as followed:

public static void renderChildren(FacesContext facesContext,
                                            UIComponent component)
throws IOException
{
   if (component.getChildCount()>  0) {
     for (Iterator it = component.getChildren().iterator();
it.hasNext();) {
       UIComponent child = (UIComponent)it.next();

       Boolean rendered = true;
       ValueExpression ve = child.getValueExpression("rendered");
       if (ve != null) {
         rendered =
           (Boolean)ve.getValue(FacesContext.getCurrentInstance()
                  .getELContext());
       }

       child.setRendered(rendered);
       renderChild(facesContext, child);
     }
   }
}

May a side effect be expected by this change?

Regards,
Wahid

Reply via email to