For my web application, I’m using RichFaces 4.X version ModalPanel for a popup window. The application is in JSF2.0 and runs on Apache Tomcat 7. Now, my popup window is working fine, but when I close my popup window, my parent window is not getting refreshed. I can see that the parent page is getting loaded(Coz I can see that all the getter methods of the binding variable are called), but all I get is a blank page. The scope of my Backing bean is “Session”. I’m pasting my JSF file here.
Please let me know what I’m missing. I’ve tried it the whole day and nothing comes to my mind anymore. 🙁
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<html>
<head>
<title>ILE Designs</title>
<script type="text/javascript">
function actionWhenMouseOver(imgName) {
var img = document.getElementById(imgName);
img.style['width'] = "300px";
img.style['height'] = "300px";
}
function actionWhenMouseOut(imgName) {
var img = document.getElementById(imgName);
img.style['width'] = "100px";
img.style['height'] = "100px";
}
</script>
</head>
<body bgcolor="000000">
<f:view>
<h:form>
<h:panelGrid border="0" columns="2">
<h:graphicImage id="logo" alt="jsf-sun" width="375" height="130" url="/default/logo.gif">
</h:graphicImage>
<h:outputText style="font-family:verdana;font-size:26pt;color:white" value="Welcome to ILE Designs Customer Portal"></h:outputText>
</h:panelGrid>
<h:panelGrid border="0" columns="3">
<h:graphicImage id="image" alt="jsf-sun" width="500" height="400" url="#{startupBean.defaultRenderedImg}">
</h:graphicImage>
<h:panelGrid style="font-family:verdana;font-size:10pt;color:black" columns="1" border="1">
<h:outputText value="Default"></h:outputText>
<rich:dataTable value="#{startupBean.objectList}" var="ObjectBO" cellspacing="20">
<rich:column>
<h:outputText style="font-family:verdana;font-size:10pt;color:black" value="#{ObjectBO.displayName}"/>
</rich:column>
<rich:column>
<h:graphicImage width="50" height="50" id="choice" alt="jsf-sun" url="#{ObjectBO.color_url}" value="#{ObjectBO.color_url}">
</h:graphicImage>
</rich:column>
</rich:dataTable>
</h:panelGrid>
<h:panelGrid id="choicetable" style="font-family:verdana;font-size:12pt;color:black" columns="1" border="1" rendered="#{startupBean.choicesFlag}">
<rich:dataTable id="datat" value="#{startupBean.choiceKeys}" var="mapEntry" cellspacing="20">
<rich:column>
<h:outputText style="font-family:verdana;font-size:12pt;color:black" value="Choice"></h:outputText><h:outputText style="font-family:verdana;font-size:10pt;color:black" value="#{mapEntry.key}"/>
<rich:dataTable value="#{mapEntry.value}" var="ObjectBO">
<rich:column>
<a4j:commandLink id="objs" action="#{startupBean.getCategory}" reRender="materialTree" ajaxSingle="true" oncomplete="Richfaces.showModalPanel('selectMaterial',{top:'10px', left:'10px', height:'400px', width:'400px'});" >
<h:outputText style="font-family:verdana;font-size:10pt;color:black" value="#{ObjectBO.displayName}" binding="#{startupBean.outTxt}"/>
<f:setPropertyActionListener target="#{startupBean.key}" value="#{mapEntry.key}" />
</a4j:commandLink>
</rich:column>
<rich:column>
<h:graphicImage width="50" height="50" id="choice" alt="jsf-sun" url="#{ObjectBO.color_url}" value="#{ObjectBO.color_url}">
</h:graphicImage>
</rich:column>
</rich:dataTable>
</rich:column>
</rich:dataTable>
</h:panelGrid>
</h:panelGrid>
<h:panelGrid border="0" columns="2" >
<h:commandButton action="#{startupBean.copyDefault}" image="/default/Duplicate.png"></h:commandButton>
<h:commandButton action="#{startupBean.renderImg}" image="/default/Previous.png"></h:commandButton>
</h:panelGrid>
</h:form>
<rich:modalPanel id="selectMaterial">
<f:facet name="header">
Material Selection
</f:facet>
<a4j:form ajaxSubmit="true">
<h:panelGrid id="materialTree">
<h:panelGrid id="tree1" border="0" columns="1">
<rich:tree style="width:300px" nodeSelectListener="#{startupBean.processSelection}"
reRender="colordtl" ajaxSubmitSelection="true" switchType="client"
value="#{startupBean.treeNode}" var="item">
</rich:tree>
</h:panelGrid>
<h:panelGrid id="colordtl" >
<h:panelGrid>
<rich:dataTable value="#{startupBean.colorList}" var="colorBO">
<f:facet name="header" >
<h:outputText value="Colors"/>
</f:facet>
<rich:column>
<a4j:commandLink id="color" actionListener="#{startupBean.getColor}">
<h:graphicImage width="100" height="100" id="colors" alt="jsf-sun" url="#{colorBO.color_url}" value="#{colorBO.color_url}" binding="#{startupBean.graphicColor}" >
</h:graphicImage>
</a4j:commandLink>
</rich:column>
</rich:dataTable>
</h:panelGrid>
<h:panelGrid border="0" columns="4">
<h:outputText value="Please select from the below options" >
</h:outputText>
<h:selectOneMenu value="#{startupBean.selectedPattern}" >
<f:selectItems value="#{startupBean.selectPattern}" />
</h:selectOneMenu>
<h:selectOneMenu value="#{startupBean.selectedFinish}" >
<f:selectItems value="#{startupBean.selectFinish}" />
</h:selectOneMenu>
</h:panelGrid>
</h:panelGrid>
<h:panelGrid columns="1">
<a4j:commandButton image="/default/Add1.png" oncomplete="#{Richfaces.hideModalPanel('selectMaterial')};"></a4j:commandButton>
</h:panelGrid>
</h:panelGrid>
</a4j:form>
</rich:modalPanel>
</f:view>
</body>
</html>
Also, In the ModalPanel commandButton oncomplete method, I’ve tried both return true and false.
Thanks,
Jane
It seems that your parent page is not refreshed at all. That’s because you need to reRender the component on the parent page that you want to be refreshed: