2 Replies Latest reply on Mar 24, 2010 7:58 AM by shobana krishnan

    Problem with RichFaces modalpanel and IE7

    shobana krishnan Newbie

      I have the following requirement
      1. User clicks on a commandLink(Implemented using a4j:commandLink)
      2. User is presented with Save Dialog box to save an excel in the desired location.

      This works fine as expected in IE and Firefox.

      But, After this operation ( i.e after the user downloads/opens the excel ), when i click any button to open a modal panel, it is not opening(Problem only in IE7 not Firefox)
      Please let me know if there is any fix for this issue, any help would be greatly appreciated.

        • 1. Re: Problem with RichFaces modalpanel and IE7
          Nick Belaevski Master



          Please post some page/beans code: modal panel code,link code, action Java code.

          • 2. Re: Problem with RichFaces modalpanel and IE7
            shobana krishnan Newbie

            Hi Nick,


            We have the following requirement.

            In our JSF application, we have a xhtml page containing a table. The user has an option to export the data from tabel to an Excel.

            We have written a custom component for this data exporter (Similar to DataExporter that PrimeFaces provides).


            There is also a a4j:commandLink on the page, which opens up a rich:modalPanel.

            The modalPanel opens correctly normally, but after the user clicks exports to excel, (the user is presented with a dialog box to open/Save the excel as attachment), the modalPanel doesn't open on clicking the a4j:commandLink.


            Can you please help me out? I found someone else faced a similar issue too (http://forums.sun.com/thread.jspa?threadID=5381418), but there was no reply to it. Your help would be greatly appreciated. Please note that our XHTML which contains the modalPanel is inside an iframe.


            I have pasted the xhtml code, and bean action for your reference.


            XHTML code containing the modalPanel:



            <ui:composition template="/templates/content.xhtml">
                <ui:define name="body">


                    <acsc:hForm id="promotionStatusForm" dirtyFlag="false">
                        <!--a4j:commandLink which opens the modalPanel-->
                                <a4j:commandLink onclick="Richfaces.showModalPanel('addPromotionList')">
                                    <acsc:hGraphicImage id="Add" value="/images/add.png"
                                        alt="Add Power Coupons" />
                                    <acsc:rSpacer width="5" />
                                    <acsc:hOutputText value="#{ToolBarBundle.ADD}" />
                        <acsc:rDataTable id="tblPromtionStatusTable"
                            var="promotionStatusDetails" reRender="dsForPromtionStatusTable" fileName="promotionStatus"
                            bundleFile="com.bally.acsc.patron.bundle.promotion_status_bundle" excludeColumns="0">


                                <f:facet name="header">
                                    <acsc:hOutputText value="#{promotionStatusBundle.PROMOTION_ID}"
                                        style="font-weight:bold;" />
                                <acsc:hOutputText value="#{promotionStatusDetails.strPromotionID}"></acsc:hOutputText>


                            <!-- Code for data table display -->




                 <!--ModalPanel code-->


                    <acsc:rModalPanel id="addPromotionList" width="500" left="175" top="125" autosized="true" onshow="setModalPanelFilterFocus();">


                        <f:facet name="header">
                            <acsc:hOutputLabel colonMark="false">
                                <acsc:hOutputText value="#{promotionStatusBundle.ADD_PROMOTIONS}"></acsc:hOutputText>


                        <f:facet name="controls">
                            <span id="hidelink" style="cursor: pointer"
                        <acsc:hForm id="addPromotionForm">
                            <acsc:rDataTable rows="#{acscUserPreferenceBean.modalPanelMaxRows}" excludeColumns="0"
                                id="addDataList" var="addPromoList" reRender="dsAddPromotionList" fileName="addPromotionStatusList"


                                    <f:facet name="header">
                                        <acsc:hOutputText value="#{labelResource.SELECT}" />
                                    <acsc:hDataTableRadio name="selectedRow1"
                                        itemValue="#{addPromoList.index}" overrideName="true"></acsc:hDataTableRadio>


                                <!--code for displaying table within modalPanel-->




                    <script type="text/javascript">
                    function setModalPanelFilterFocus()
                    function setRadioSelID()






            By default, we are setting an export to excel icon at the footer of the rich:datatable, clicking which, the user can export the excel using Open/Save as option.


            I have attached the bean action for the export to excel code:


                public String exportToExcelAction(){
                try {
                    FacesContext facesContext = FacesContext.getCurrentInstance();
                    ACSCExporter exporter=null;
                    if(type !=null){
                        exporter= ACSCExporterFactory.getExporterForType(type);   
                 //Some validation code goes here       
                     if(table!=null && exporter !=null)
                        exporter.export(facesContext, table, fileName, excludeColumnsAr,excludeRowsArray, bundleFile);


                    } catch (IOException e) {
                        throw new FacesException(e);
                return "success";   


            The export method which does the actual export to excel is:

            public void export(FacesContext facesContext, UIData data, String filename,
                        List<String> excludedColumns, List<String> excludedRows, String bundleFile) throws IOException {
                    HSSFWorkbook wb = new HSSFWorkbook();
                    HSSFSheet sheet = wb.createSheet();


                      Code for populating the excel with values from dattatable goes here
                    writeExcelToResponse(((HttpServletResponse)facesContext.getExternalContext().getResponse()), wb, filename);



            private void writeExcelToResponse(HttpServletResponse response, HSSFWorkbook generatedExcel, String filename) throws IOException {
                    response.setHeader("Expires", "0");
                    response.setHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0");
                    response.setHeader("Pragma", "public");
                    response.setHeader("Content-disposition", "attachment;filename="+ filename + ".xls");





            Note:Please let me know what could be wrong here. The problem seems to get solved, if I change the Content-disposition from attachment to inline,  (in the writeExcelToResponse() given above) while saving