What is objType. is it a string? do you have the case correct? also
your 'rectangle' check is missing the last single quote.

The EL should not be evaluated until render time, so if the rendered =
false, then it should not be executed. Try this to make sure your
checks are correct:

<ui:repeat var="graphicsObj" value="#{graphicsObjList}">
  Circle: <h:outputText value="#{graphicsObj.objType eq 'circle'}" />
  Rectangle: <h:outputText value="#{graphicsObj.objType eq 'rectangle'}" />
  Class: <h:outputText value="#{graphicsObj.class.name}" />
</ui:repeat>

Hopefully that may shed some light. If not, post the results and your
'graphicsObj' java code and perhaps we can find something there.

-Andrew

On 7/25/06, Venkat Rao <[EMAIL PROTECTED]> wrote:
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