开发者

JSF visibility on ICEFaces Push update - strange behavior

开发者 https://www.devze.com 2023-04-13 07:24 出处:网络
I have a problem with conditional rendering of JSF components updated with ICEFaces Push. The use case is I\'m looping through images in directory, and on new image I\'m calling ICEFaces Push Rendere

I have a problem with conditional rendering of JSF components updated with ICEFaces Push.

The use case is I'm looping through images in directory, and on new image I'm calling ICEFaces Push Renderer, so that xhtml page will get an updated image and its info. Image is shown in one panel, while its info - in another. The info is not always accessible, and when it's not - I want to show a team logo instead of info panel. This is the xhtml code:

<ice:graphicImage height="1024" width="768" value="#{viewBean.image}"></ice:graphicImage>
    <h:panelGrid border="0" columns="1">
        <c:choose>
            <c:when test="${viewBean.infoAccessible}">
          开发者_JAVA百科      <h:panelGrid border="0" columns="2">


                    <h:outputText value="Data:"></h:outputText>
                    <h:outputText value="#{viewBean.info.time}"></h:outputText>

                </h:panelGrid>
            </c:when>

The code above, together with server-side codes work as intended, but there's a strange side effect I do not understand. There should be 1 call of viewBean.image, but it increments... so as the app runs - I get up to 70+ calls to this method, which is not the case, when I remove the viewBean.infoAccessible condition check.

... I can provide also a server-side sources, but there's no direct interconnection between viewBean.image and vievBean.infoAccessible (also some other ppl had a look at my codes). So - what's the problem here? What am I missing?

Is there any other way to hide/show JSF components on ICEFaces Push update?


I use the visible="#{mybean.visible}" attribute to control the visibility of my ICEfaces components from my Java managed beans.

I am not surprised that you get some strange results mixing <c:choose> and ICEpush because that makes it difficult for ICEfaces/ICEpush to determine what has changed on the page and needs to be pushed to the client.

Can you use the visible attribute and managed beans to turn components on/off without <c:choose>? Then all the logic for page display is in managed beans and not in JSF pages.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号