I am facing strange issue related with af:inlineFrame
component. Trying to display/render ADF page inside of af:popup
within af:inlineFrame
component. The weird thing is when the popup displayed; view scoped bean's @PostConstruct
method called twice. That means bean is initialized twice. However it needed to be initialized once since bean is referenced from the page that is going to be displayed inside af:inlineFrame
.
Correct flow gotta be:
- Click to button
openPopup()
method called. openPopup()
sets URI then opens popup.inlineFrame source
property set as it's going to display framePage.jspx
.- JSF scans
framePage.jspx
code finds out there is a reference to FrameBean
inside af:outputLabel
- Construct
FrameBean
then call @PostConstruct
method. - Call appropriate getter and render page.
What happens in my case:
- Click to button
openPopup()
method called. openPopup()
sets URI opens popup.inlineFrame source
property set as it's going to display framePage.jspx
.- JSF scans
framePage.jspx
code finds out there is a reference to FrameBean
inside af:outputLabel
- Construct
FrameBean
then call @PostConstruct
method. - Call appropriate getter and render page.
- Construct
FrameBean
then call @PostConstruct
method. - Call appropriate getter and render page.
Popup located like:
<af:popup id="mainPopup" binding="#{mainBean.mainPopup}">
<af:dialog id="mainDialog">
<af:inlineFrame source="#{mainBean.URI}"> </af:inlineFrame>
</af:dialog>
</af:popup>
Showing popup via af:button action="#{mainBean.openPopup}"
:
public void openPopup() {
this.setURI("http://localhost:7001/app/framePage.jspx");
RichPopup.PopupHints hints = new RichPopup.PopupHints();
this.getMainPopup().show(hints);
}
framePage.jspx:
<?xml version='1.0' encoding='UTF-8'?> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <jsp:directive.page contentType="text/html;charset=UTF-8" />
<f:view>
<af:document title="Frame Demo" id="demoDocument">
<af:form id="demoForm">
<af:outputLabel value="#{frameBean.commonId}"> </af:outputLabel>
</af:form>
</af:document>
</f:view>
</jsp:root>
FrameBean:
@ManagedBean
@ViewScoped
public class FrameBean {
private String commonId;
@PostConstruct
public void afterInit() { }
public String getCommonId() {
return commonId;
}
public void setCommonId(String commonId) {
this.commonId = commonId;
}
}
Making FrameBean
@SessionScoped
solves this issue since bean is kept with session but I don't want to keep it within session. Also setting source
property of af:inlineFrame
in jspx as hardcoded not fixing the problem.