8 Replies Latest reply on Feb 3, 2011 9:04 AM by Nilakandan V

    a4j:poll returns Permission denied with IE 7

    Olena Mitovska Newbie

      I use a4j:poll component to reload part of the JSF page. This works fine with IE 6 but returns "Permission denied" JavaScript error when used with IE7. I work with the latest ajax4jsf version 1.1.0.

      Is it a bug that will be fixed in the later ajax4jsf version? Is there a workaround to fix it meanwhile?

      Thanks,
      Olena

        • 1. Re: a4j:poll returns Permission denied with IE 7
          Sergey Smirnov Master

          we need more information about the problem you have.

          • 2. Re: a4j:poll returns Permission denied with IE 7
            Olena Mitovska Newbie

            Here is my HTML code. All page resources are located on the same domain.

            <html>
            <head>
            <title>Traveller Information System - Welcome</title>
            <script type='text/javascript' src='/AVL/AVL/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript'>
            </script>
            <script type='text/javascript' src='/AVL/AVL/a4j.res/org/ajax4jsf/renderkit/html/scripts/form.js'>
            </script>
            
            <script>
            function buildURL()
            {
             var f = document.forms['avl_main_form'];
             var faction='?goTime=' + document.getElementById("avl_main_form:goTimeNumId").value;
             faction=faction+'&busRoute=' + document.getElementById("avl_main_form:busRouteNumId").value;
             f.action=f.action.substring(0,f.action.indexOf('.jsf') + 4) + faction;
            }
            </script>
            </head>
            
            <body>
            <div align="center">
            <table id="perimeter" border="0" cellpadding="0" cellspacing="0">
            <tr><td id="header"></td></tr>
            <tr><td id="stage">
            <table id="center1" width="720" cellpadding="0" cellspacing="0" border="0" bgcolor="FBEECB">
             <tr>
             <td class="stage_left">
             <table id="center_left" width="200" border="0" cellspacing="0" cellpadding="10">
             <tr><td></td></tr>
             <tr><td></td></tr>
             </table>
             </td>
             <td class="stage_centre">
            <table width="520" id="center_right" border="0" bordercolor="purple" cellspacing="0" cellpadding="0">
             <tr>
             <td valign="top">
             <table id="grid1" border="0" cellpadding="0" cellspacing="10" width="100%">
             <tbody><tr><td>
             <table id="grid2" border="0" cellpadding="0" cellspacing="10" width="100%">
             <tbody>
             <tr><td><span class="permitTitle">Real-time Bus Departure Information</span></td></tr>
             <tr><td>
             <form id="avl_main_form" name="avl_main_form"
             method="post" onsubmit="javascript:buildURL()"
            action="/AVL/departures.jsf;jsessionid=FA9C4D6BF7A17092EF1CDC9E8A5DC1C4">
             <table id="avl_main_form:grid4" border="0" cellpadding="0" cellspacing="2" width="100%" style="text-align: left; vertical-align: top;">
             <tbody>
             <tr><td><b>GoTime #</b>
             <input id="avl_main_form:goTimeNumId"
             name="avl_main_form:goTimeNumId" type="text"
             value="0732" maxlength="5" size="6" />
             </td>
             <td><b>Bus Route</b>
             <input id="avl_main_form:busRouteNumId"
             name="avl_main_form:busRouteNumId"
             type="text" value="" maxlength="3" size="6" />
             </td></tr>
             <tr><td></td><td>(Optional)</td></tr>
             </tbody></table>
             <table id="avl_main_form:grid7" border="0" cellpadding="10" cellspacing="0" width="100%" style="text-align: center;">
             <tbody>
             <tr><td><input id="avl_main_form:submitButton"
             name="avl_main_form:submitButton" type="submit"
             value="Submit" onclick="clear_avl_5Fmain_5Fform();" /></td></tr>
             <tr><td></td></tr>
             </tbody></table>
             <table id="avl_main_form:grid9" border="0" cellpadding="0"
             cellspacing="10" width="100%">
             <tbody><tr><td>
             <span class="title">Next Departures</span></td></tr>
             <tr><td>For GoTime <b>0732</b> and Bus Route
             <b>Unspecified</b></td></tr>
             </tbody></table>
            
            <span style="display:none;" id="avl_main_form:_idJsp18">
            
            <script type="text/javascript"><!--
            A4J.AJAX.Poll('_viewRoot','avl_main_form',{'pollId':'avl_main_form:_idJsp18','parameters':{'avl_main_form:_idJsp18':'avl_main_form:_idJsp18'},'actionUrl':'/AVL/departures.jsf;jsessionid=FA9C4D6BF7A17092EF1CDC9E8A5DC1C4','pollinterval':20000});
            
            //--></script>
            
            </span>
            
            <table id="avl_main_form:grid14" border="0" cellpadding="0" cellspacing="0" width="100%" style="text-align: right;">
            <tbody><tr><td>
            <span id="avl_main_form:serverTimeId">2:06 PM</span></td></tr>
            <tr><td>
            <table id="avl_main_form:departure_table" width="100%"
            class="tableContents">
            <thead><tr><th class="columnHeadersAlt">Route</th><th
            class="columnHeadersAlt">First</th><th class="columnHeadersAlt">Second</th><th class="columnHeadersAlt">Schedule</th></tr></thead>
            <tbody id="avl_main_form:departure_table:tbody_element">
            <tr class="evenRowAlt"><td>86</td>
            <td><span id="avl_main_form:departure_table:0:scheduledTimes1">5:25 PM <b><font color='red'>!</font></b></span></td>
            <td><span id="avl_main_form:departure_table:0:departureTime2"></span>
            <span id="avl_main_form:departure_table:0:reportingFlag2">No Service</span></td>
            <td><a id="avl_main_form:departure_table:0:_idJsp28" name="avl_main_form:departure_table:0:_idJsp28" href="#" target="blank">
            <img src="../sharedHRM/images/buttons/clock_icon.gif;jsessionid=FA9C4D6BF7A17092EF1CDC9E8A5DC1C4" alt="Bus Schedule" style="border: none" /></a>
            </td></tr></tbody></table>
            </td></tr>
            </tbody></table>
            <input type="hidden" name="avl_main_form" value="avl_main_form" />
            <input type="hidden" name="autoScroll" /><input type="hidden" name="avl_main_form:_idcl" />
            <input type="hidden" name="avl_main_form:_link_hidden_" />
            
            <script type="text/javascript"><!--
            function clear_avl_5Fmain_5Fform() {
            _clearJSFFormParameters('avl_main_form','',['avl_main_form:_idcl','avl_main_form:_link_hidden_']);
            }
            function clearFormHiddenParams_avl_5Fmain_5Fform(){clear_avl_5Fmain_5Fform();}
            clear_avl_5Fmain_5Fform();
            //--></script>
            <input type="hidden" name="jsf_sequence" value="1" />
            </form>
            
            </td></tr>
            </tbody></table>
            </td></tr></table></td></tr></table></td></tr>
            </table>
            </div>
            </body>
            </html>
            
            
            
            


            • 3. Re: a4j:poll returns Permission denied with IE 7
              Sergey Smirnov Master

              How the original jsp page looks like

              • 4. Re: a4j:poll returns Permission denied with IE 7
                Olena Mitovska Newbie

                I use Tiles template framework. Here is my "body" tile.
                I noticed one interesting thing, if I load this JSF page in th browser on the same machine where Java app is hosted, the page reloads successfully even with IE7; but if I access the page from the remote machine, I get "Permission denied" when a4j:poll reloads the part of the page.

                <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
                <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
                <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
                <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
                
                
                <f:view>
                <f:loadBundle basename="ca.halifax.avl.messages.ApplicationMessages"
                var="msg" />
                <h:panelGrid id="grid1" columns="1" cellpadding="0" cellspacing="10" border="0" width="100%">
                <a4j:form id="avl_main_form" onsubmit="javascript:buildURL()">
                <h:panelGrid id="grid4" width="100%" cellpadding="0" border="0"
                columns="2" cellspacing="2" style="text-align: left; vertical-align: top;">
                <h:panelGroup>
                <h:outputText value="#{msg.goTimeNum} " escape="false" />
                <t:inputText id="goTimeNumId" value="#{avlViewBean.goTime}"
                 required="true" size="6" maxlength="5" />
                </h:panelGroup>
                
                <h:panelGroup>
                <h:outputText value="#{msg.busRouteNum} " escape="false" />
                <t:inputText id="busRouteNumId" value="#{avlViewBean.busRoute}"
                size="6" maxlength="3" />
                </h:panelGroup>
                
                </h:panelGrid>
                
                <h:panelGrid id="grid7" columns="1" width="100%" cellspacing="0"
                cellpadding="10" style="text-align: center;">
                <t:commandButton id="submitButton" value="Submit"
                action="#{avlViewBean.submitAction}"></t:commandButton>
                </h:panelGrid>
                
                <a4j:poll interval="10000" reRender="serverTimeId" ajaxSingle="false"
                 action="#{avlViewBean.submitAction}" />
                <h:panelGrid id="grid14" columns="1" width="100%" cellspacing="0"
                cellpadding="0" style="text-align: right;" rendered="#{!empty avlViewBean.result.departureTimes}">
                <h:outputText id="serverTimeId" value="#{avlViewBean.serverTime}"
                 escape="false" />
                
                <h:dataTable id="departure_table" width="100%"
                value="#{avlViewBean.result.departureTimes}" var="departureTime"
                styleClass="tableContents" headerClass="columnHeadersAlt"
                rowClasses="evenRowAlt, oddRowAlt">
                
                <h:column>
                <f:facet name="header">
                <h:outputText value="Route" />
                </f:facet>
                
                <h:outputText value="#{departureTime.routeID}" />
                </h:column>
                
                </h:dataTable>
                </h:panelGrid>
                </a4j:form>
                
                </h:panelGrid>
                </f:view>
                


                • 5. Re: a4j:poll returns Permission denied with IE 7
                  Olena Mitovska Newbie

                  It was JSF (MyFaces impl) that was causing the error. I have the mapping for the Faces Servler defined this way:

                   <servlet-mapping>
                   <servlet-name>Faces Servlet</servlet-name>
                   <url-pattern>/AVL/*</url-pattern>
                   </servlet-mapping>
                   <servlet-mapping>
                   <servlet-name>Faces Servlet</servlet-name>
                   <url-pattern>*.jsf</url-pattern>
                   </servlet-mapping>
                  

                  and the navigation rule looked as follows:
                   <navigation-rule>
                   <from-view-id>/departures.jsp</from-view-id>
                   <navigation-case>
                   <from-outcome>success</from-outcome>
                   <to-view-id>/departures.jsp</to-view-id>
                   </navigation-case>
                   <navigation-case>
                   <from-outcome>error</from-outcome>
                   <to-view-id>/departures.jsp</to-view-id>
                   </navigation-case>
                  </navigation-rule>
                  


                  Once I removed "success" and "error" navigation cases from the faces-config.xml file, the error disappeared and page realods successfully. I am not sure how JSF navigation impacts AJAX request processing and why in EI7 it gave "Permission denied" error.


                  • 6. Re: a4j:poll returns Permission denied with IE 7
                    Sergey Smirnov Master

                     

                    <a4j:form id="avl_main_form" onsubmit="javascript:buildURL()">


                    What do you do inside the buildURL() method?

                    • 7. Re: a4j:poll returns Permission denied with IE 7
                      Sergey Smirnov Master

                      If you have an action method and want Ajax Request generate Ajax Response, the action method must return null. Otherwise, it would be non-Ajax Response is the action method outcome matches one of the navigation rule.

                      • 8. Re: a4j:poll returns Permission denied with IE 7
                        Nilakandan V Newbie

                        Hi,

                         

                        I'm facing the same problem using <a4j:poll> in IE7. but it was working fine in IE6...Please suggest me the possible solution for this...

                         

                        Thanks,

                        Nila