0

对于我的 Web 应用程序,我使用 RichFaces 4.X 版本的 ModalPanel 作为弹出窗口。该应用程序在 JSF2.0 中并在 Apache Tomcat 7 上运行。现在,我的弹出窗口工作正常,但是当我关闭弹出窗口时,我的父窗口没有刷新。我可以看到父页面正在加载(因为我可以看到绑定变量的所有 getter 方法都被调用),但我得到的只是一个空白页面。我的支持 bean 的范围是“会话”。我在这里粘贴我的 JSF 文件。

请让我知道我错过了什么。我已经尝试了一整天,但现在什么都没有出现在我的脑海中。:(

<%@ 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>

此外,在 ModalPanel commandButton oncomplete 方法中,我尝试了返回 true 和 false。

谢谢,简

4

1 回答 1

1

您的父页面似乎根本没有刷新。那是因为您需要在要刷新的父页面上重新渲染组件:

<a4j:commandButton image="/default/Add1.png" 
       reRender="someComponentId(s) on the parent page" 
            oncomplete="Richfaces.hideModalPanel('selectMaterial');">
于 2012-08-30T08:23:51.353 回答