我创建了一个带有 primefaces 的页面,我在其中使用了 Lightbox 组件。
我在动态事务中使用它,因为我通过 servlet 调用动态创建缩略图。
第一页显示得很好,灯箱按预期工作,但是当我为下一页加载一组新图片时,会显示图片但是当你点击它时,它只会在新页面中显示原始图片,当我然后使用上一个按钮返回并单击缩略图,它按预期工作。
这是jsf代码:
<h:outputLabel id="curpage" value="#{pictureBean.currentPage}" />
<h:commandButton value="next" action="#{pictureBean.nextPage}" id="next">
<f:ajax render="lightBox curpage" />
</h:commandButton>
<br/>
<p:lightBox height="500px" id="lightBox">
<ui:repeat value="#{pictureBean.pictures}" var="pic">
<h:outputLink value="#{pic.url}" title="#{pic.description}">
<h:graphicImage value="#{pic.urlThumb}" style="width:100px;height:75px;"/>
</h:outputLink>
</ui:repeat>
</p:lightBox>