myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Koci <martin.kocicak.k...@gmail.com>
Subject [core] implicit object 'component' in rendered expression (myfaces and spec bug)
Date Wed, 25 May 2011 16:52:35 GMT
Hi,

<h:form>
	<h:panelGroup>
                <h:inputText id="testId" 
		rendered="#{component.id eq 'testId'}"  				value="#{bean.value}" />
	</h:panelGroup>
</h:form>

please notice the expression:

rendered="#{component.id eq 'testId'}" 

that is clearly true.

But that does not work as expected: inputText is rendered, but never
updates model value.


Problem 1.

from specification, methods UIComponent.process* and encode*
1) If the rendered property of this {@link UIComponent}
false, skip further processing 
2) Call {@link #pushComponentToEL}

-> #{component} resolves in rendered="#{}" to parent!


Problem 2.

MyFaces implement that (pointless) requirement inconsistently: from
UIComponentBase.process*:

(!isRendered())
  return;
pushComponentToEL(context, this)

and from UIComponentBase.encodeBegin*
 pushComponentToEL(context, this);
 if (isRendered())


causes that example above renderes inputText, but never updates model.

Problem 3.

RendererUtils.renderChild(FacesContext, UIComponent): 
in this method it is unappropriate to use following code:

if (!child.isRendered()) {
            return;
        }
child.encodeBegin(facesContext);

because:
1) it does not take into account pushComponentToEL ( #{component}
resolves to parent)
2) behaviour is incosistent with UIComponent.encodeBegin : you'll get
"random" rendering - depends if parent of component renders it's
children or not! For this case I've created MYFACES-3126, but I'll
reopen it now, because simple remove of 'if (!child.isRendered())' does
not solve that problem and causes another problem if component
getRendersChildren = false;


What do yout think about this problem?


Regards,

Kočičák



Mime
View raw message