I am facing iframe issue in primefaces. iframe call twice postConstruct init() method in the backing bean.
- Call another page in the dialog using an iframe.
Scope of beans :
View
Code:
searchViewDlgBean.java
searchViewDlg.xhtmlcndViewDlgUrl="/page/wf/candidateViewDlg.xhtml?cndId=123"
candidateViewDlg.xhtml<p:dialog closeOnEscape="true" responsive="true" id="searchViewDlg"
<h:form id="frmViewCndInfo">
<iframe height="100%" width="1110" style="border: #ccc solid 0px; height: 100%"
src="#{pc_quickSearchBean.cndViewDlgUrl}"> </iframe>
</h:form>
</p:dialog>
CandidateViewDlgBean.java<ui:composition template="/page/candidate/templ.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
<ui:define name="content">
<h:form id="frmDwnldRsm">
<p:outputLabel value="#{pc_candidateViewDlgBean.cndId}"></p:outputLabel>
</h:form>
</ui:define>
</ui:composition>
Log:@PostConstruct
public void init() {
logger.info("entered in init() of CandidateViewDlgBean");
try {
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
if (request .getParameter("cndId") != null) {
cndId = Integer.parseInt(request .getParameter("cndId"));
logger.debug("cndId>>>>>>>>>>>" + cndId);
}
} catch (Exception e) {
logger.error("Exception : ", e);
}
}
2019-06-17 07:34:30,948 [CandidateViewDlgBean]- entered in init() of CandidateViewDlgBean
2019-06-17 07:34:30,948 [CandidateViewDlgBean]- entered in init() of CandidateViewDlgBean
2019-06-17 07:34:30,948 [CommonUtil]- Session in getAttr14B2ACBF45DC1B43310EE7AEF282A542
2019-06-17 07:34:30,948 [CommonUtil]- Session in getAttr14B2ACBF45DC1B43310EE7AEF282A542
2019-06-17 07:34:30,948 [CandidateViewDlgBean]- cndId>>>>>>>>>>>123
2019-06-17 07:34:30,948 [CandidateViewDlgBean]- cndId>>>>>>>>>>>123
Please help me to solve out this issue.
Thanks