当您单击链接以使用新页面参数转到同一页面时,我正在尝试在adf中更新整个页面。如果我在新标签页中打开链接,则可以正常运行,但是在同一标签页中打开链接不会更新。
我有一个页面,仅显示url中的参数值,带有相同参数值的指向同一页面的链接,以及显示日期时间的输出文本。我的任务流通过调用RetrieveDateTime()开始,然后转到refrestTest.jsff。任务流是refresh.jsf页面上的一个区域。
public class RefreshDC {
private String dateTime;
public RefreshDC() {
super();
}
public void RetrieveDateTime() {
System.out.println("DC RETRIEVEDATETIME");
RefreshFacade rf = new RefreshFacade();
this.dateTime = rf.getDate().getDatetime();
}
public void setDateTime(String dateTime) {
this.dateTime = dateTime;
}
public String getDateTime() {
return dateTime;
}
}
页面片段:
//refreshTest.jsff
<?xml version='1.0' encoding='UTF-8'?>
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:panelGroupLayout id="pgl1" layout="vertical">
<af:outputText value="#{param.id}" id="ot1"/>
<af:goLink text="RP PDTLS" id="gl1" destination="/faces/refresh.jsf?
id=1234567890"/>
<af:outputText value="DateTime: #{bindings.dateTime.inputValue}"
shortDesc="#{bindings.dateTime.hints.tooltip}" id="ot2"
partialTriggers="gl1"/>
</af:panelGroupLayout>
</ui:composition>
页面:
//refresh.jsf
<f:view xmlns:f="http://java.sun.com/jsf/core"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:document title="refresh.jsf" id="d1">
<af:form id="f1">
<af:region value="#{bindings.refresh1.regionModel}" id="r1"/>
</af:form>
</af:document>
</f:view>
正如我所说,如果在新选项卡中打开goLink,它将更新dateTime,但是,如果在同一选项卡中打开,则dateTime将保持不变。 (这两种情况下的param.id都会更新)
答案 0 :(得分:0)
您可以通过用调用以下java Bean函数的ActionListener的adf按钮替换golink,以编程方式刷新整个页面:
public static void refreshPage() {
FacesContext fc = FacesContext.getCurrentInstance();
String refreshpage = fc.getViewRoot().getViewId();
ViewHandler ViewH = fc.getApplication().getViewHandler();
UIViewRoot UIV = ViewH.createView(fc, refreshpage);
UIV.setViewId(refreshpage);
fc.setViewRoot(UIV);
}
答案 1 :(得分:0)
我设法使用任务流解决了这个问题。基本上,我使按钮转到具有区域的新页面。该区域具有读取url参数的任务流,如果符合我的条件,则使用新参数(toDocumentsPage)链接回原始页面。否则,请转到其他页面(searchResults)。Taskflow to refresh the page