我张贴谷歌搜索了很多,很多与AF实验后,这个问题:图像组件。AF:图像不被刷新
我的情况如下:
我有一个AF:链接被打开AF:弹出从背衬豆如下所示:
<af:link text="Link" id="l3"
actionListener="#{myBean.myActionListener}">
<f:attribute name="personId" value="#{row.PersonId}"/>
<f:attribute name="fullName" value="#{row.FullName}"/>
</af:link>
和myActionListener方法是这样的:
public void myActionListener(ActionEvent actionEvent) {
if (actionEvent.getComponent().getAttributes().get("personId") != null) {
Long personId = (Long) actionEvent.getComponent().getAttributes().get("personId");
String fullName = (String)actionEvent.getComponent().getAttributes().get("fullName");
// puting the attributes in the page Flow Scope
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("currentPersonId", currentPersonId);
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("currentFullName", currentFullName);
String imageUrl = "/myImageServlet?personId="+personId ;
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("imageUrl", imageUrl);
// check if the image is stored in the file system
String fileLocation = "C:\\pics\\" ;
File imageFile = new File(fileLocation + personId);
if(imageFile.exists()){
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("personImageExist", true);
}else {
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("personImageExist", false);
}
//show the popup here
RichPopup.PopupHints hints = new RichPopup.PopupHints();
this.getImagePopupTab2().show(hints);
}
}
然后是我的弹出与AF:像这样的:
<af:popup childCreation="immediate" autoCancel="disabled" id="imagePopupTab2"
binding="#{myBean.imagePopupTab2}" contentDelivery="lazyUncached">
<af:dialog id="d123456" closeIconVisible="false">
<af:panelGroupLayout id="pgl899" layout="vertical">
<af:panelGroupLayout id="pgl1110" layout="horizontal">
<af:spacer width="20" height="10" id="s34"/>
<af:image source="#{pageFlowScope.imageUrl}"
id="i222" rendered="#{pageFlowScope.personImageExist}"
/>
</af:panelGroupLayout>
</af:panelGroupLayout>
</af:dialog>
</af:popup>
以下效果很好,我的问题是当我尝试更新的文件系统映像文件,然后再次调用弹出,T 他旧形象仍缓存在那里,它不会刷新。
香港专业教育学院尝试了以下解决方案,它没有工作:
1-增加的部分触发为AF:图像更新后刷新。
2-添加一个局部触发AF:图像父布局进行刷新。
3我试图从backing bean中设置源属性为af:image。
4我也试过h:graphicImage and tr:image同样的事情。
问题是,af:image没有再次调用源Servlet,我不知道为什么。