You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Venkat Rao <ve...@cadenasoft.com> on 2006/07/31 18:42:31 UTC
"rendered" condition does not work as expected
My code inside a "rendered" flag is getting invoked even when the condition
is false. I am iterating over a list of Graphics objects to display
information about each by calling the object specific methods. The code
works fine if I use only <h:outputText>. If I use <h:inputText> however, the
rendered property does not seem to be taking effect.
<ui:repeat var="graphicsObj" value="#{gfx.graphicsObjList}">
<h:panelGroup rendered="#{graphicsObj.objType == 'circle'}" >
[Circle] Radius: <h:outputText value="#{graphicsObj.radius}"/>
</h:panelGroup>
<h:panelGroup rendered="#{graphicsObj.objType == 'rectangle'}" >
[Rectangle] Length: <h:outputText value="#{graphicsObj.length}"/>
</h:panelGroup>
</ui:repeat>
The above works fine, as expected. However, if I change from <h:outputText>
to <h:inputText>, it complains :
javax.faces.el.PropertyNotFoundException: /graphics.xhtml @24,54
value="#{graphicsObj.radius}": Bean: Rectangle, property: radius
So, the first block of code is getting executed for a Rectangle object when
using a <h:inputText> but not when using <h:outputText>.
Any help in solving the problem is appreciated. The code for the Circle and
Rectangle beans is given below:
public class Circle implements Serializable
{
public String getObjType() {
return "circle";
}
int radius;
public void setRadius(int radius) {
this.radius = radius;
}
public int getRadius() {
return this.radius;
}
}
public class Rectangle implements Serializable
{
public String getObjType() {
return "rectangle";
}
private int length;
public void setLength(int length) {
this.length = length;
}
public int getLength() {
return this.length;
}
}