5 Replies Latest reply: Sep 6, 2012 5:26 AM by Bhargava Chittajallu RSS

RF + iframe + IE8 + jasper : showWhenRendered issue

Mikael Vivier Newbie

Hi everyone,

 

I got some strange issue and I really don't know what the matter is precisely, so I need your help.

 

First of all I use these versions :

- RichFaces 3.3.3.Final

- jasperReport 3.7.5

- itext 2.1.7

- Internet Explorer 8

 

I have a panel in my application for automaticaly display error or information messages with MessagesManager :

<a4j:outputPanel ajaxRendered="true">
     <rich:modalPanel onshow="document.getElementById('messagePanelId:closeButtonId').focus();" id="messagePanel" showWhenRendered="#{facesContext.maximumSeverity != null}">
          ...
     </rich:modalPanel>
</a4j:outputPanel>

 

And I have a JSP with only 2 buttons, one for add an error in the MessagesManager (this way I can test the display of my "messagePanel") and one for generate and open a PDF (using JasperReport) :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" >
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<html>
    <head>
                    <link rel="stylesheet" type="text/css" href="${request.contextPath}/styles/core.css" />
                    <script language="javascript" src="<%=request.getContextPath()%>/scripts/core.js"></script>
    </head>
             <body>
                    <f:view>
                              <h:form id="mainFormId" style="text-align: center"> 
                                        <%-- print button --%>
                                        <a4j:outputPanel>
                                                  <h:commandButton action="#{testControllerBean.printListPiecesPDF}" type="button" value="Imprimer"/>
                                        </a4j:outputPanel> 
                                        <%-- error button --%>
                                        <a4j:commandButton action="#{testControllerBean.displayError}"  type="button" value="Display error"/>
                              </h:form>
            <%@include file="/pages/message.jsp"%>
                    </f:view>
    </body>
</html>

 

So, like this, it is working as intended.

 

Now, for some reason, I have to use an iframe in my application like this :

<iframe style="position:absolute;width: 100%; height: 100%; overflow-y: hidden; z-index: 1" frameBorder="0"
            src="http://localhost:8080/mvn_test/pages/main.jsf"/>

 

And here comes the bug : when I click on the error button, no problem, the message is display but if I click on the PDF button (generate and open PDF) then the message can't be display (when I click on the errorbutton). I can see with the debugger that the action of my controller is called but the message doesn't appear on the screen.

 

So my question is : why without the iframe everything is working as expected but not with ? Why generate a PDF makes the "showWhenRendered" option doesn't work anymore ?

 

Note : - the issue is present only on Internet Explorer, there are no issues with Firefox or Chrome.

           - I am not English, so forgive me for my mistakes and I hope you still understand me.

  • 1. Re: RF + iframe + IE8 + jasper : showWhenRendered issue
    Mikael Vivier Newbie

    No one have an idea ?

    Not necessary solve this issue but some workaround would be a great help too.

  • 2. Re: RF + iframe + IE8 + jasper : showWhenRendered issue
    Bhargava Chittajallu Newbie

    Mikael - Did you get to a solution for your above problem?

     

    We too have a similar issue. We have our web application in an iFrame.

     

    Richfaces version: 3.3.3.Final

     

    Issue description: The page has a  button that exports data on the page into a PDF (the data is flushed out through an OutputStream with appropriate content type application/pdf set). This page has modal panel to show the 'waiting...' message when the user does any operation on the page. The modal panel works well in all the cases until the export button is clicked. However, once the export button is clicked and the PDF is served, all successive requests do not bring up the modal panel with the 'waiting...' message. When this application is accessed independently, we do not have any such issues. This happens only when the application is embedded within an iframe and in IE 8. Mozilla firefox has no such issue.

     

    Workaround: I have set the target of the export button click to a new window. This resolves the issue but brings another window on top of the existing window until the PDF is saved or opened. The new window closes automatically.

     

    Is there a solution available for this issue? Please advise.

  • 3. Re: RF + iframe + IE8 + jasper : showWhenRendered issue
    Mikael Vivier Newbie

    Hi Bhargava,  I completly forget I had post the issue here so yeah I find a solution, or rather a workaround so this can work on IE8.

    The solution is actually pretty simple :  I just put the button in an other iframe (so an iframe in my iframe) and then there is no more issue.

     

    So here is the iframe code :

    <iframe src="print.jsf" frameBorder="0" width="100" height="100">Votre navigateur ne gère pas les iframes !</iframe>

     

    And the print.jsp code :

    <html>
        <head></head>
                 <body>
                           <f:view>
                                  <h:form id="printFormId" style="text-align: right">
                                            <%-- bouton pour l'impression --%>
                                            <h:commandButton action="#{ossmanControllerBean.printListPiecesPDF}"/>
                                  </h:form>
                        </f:view>
        </body>
    </html>
    

     

    Give it a try and let me know if it's ok for you.

  • 4. Re: RF + iframe + IE8 + jasper : showWhenRendered issue
    Bhargava Chittajallu Newbie

    Thanks, Mikael. Appreciate your help. I will try this workaround tomorrow at work and let you know. Once again, thank you. 

  • 5. Re: RF + iframe + IE8 + jasper : showWhenRendered issue
    Bhargava Chittajallu Newbie

    Yes, it worked. Thank you, Mikael.