I am iterating over a list of Graphics entity objects, and am
displaying information about each in input controls, by calling the
object specific methods, as in the following code

<ui:repeat var="graphicsObj" value="#{graphicsObjList}">

    <h:panelGroup rendered="#{graphicsObj.objType == 'circle'}" >
        <h:outputLabel for="radiusTF">Enter Radius:</h:outputLabel>
        <h:inputText id="radiusTF" value="#{graphicsObj.radius}"/>
    </h:panelGroup>

    <h:panelGroup rendered="#{graphicsObj.objType == 'rectangle}" >
        <h:outputLabel for="lengthTF">Enter Length:</h:outputLabel>
        <h:inputText id="lengthTF" value="#{graphicsObj.length}"/>
    </h:panelGroup>

</ui:repeat>

Based on the type of the object, I am calling the object-specific
method such as getRadius() or getLength(). This gives the following error. 

javax.faces.el.PropertyNotFoundException: /graphicsView.xhtml @31,80
value="#{graphicsObj.radius}": Bean: com.serviceramp.model.Rectangle,
property: radius

It appears that even when the object is of type rectangle, it executed
the first block of code, and is calling the getRadius() method. 

However, if I replace the HTMLInputText with HTMLOutputText, as in the
code below, it works perfectly.

<ui:repeat var="graphicsObj" value="#{graphicsObjList}">

    <h:panelGroup rendered="#{graphicsObj.objType == 'circle'}" >
        <h:outputText value="Found circle with radius:
#{graphicsObj.radius}"/>
    </h:panelGroup>

    <h:panelGroup rendered="#{graphicsObj.objType == 'rectangle}" >
        <h:outputText value="Found rectangle with length:
#{graphicsObj.length}"/>
    </h:panelGroup>

</ui:repeat>

What is going wrong here? How can I get the desired effect of creating
dynamic input components?

Thanks,
-- venkat
[EMAIL PROTECTED]

Reply via email to