14 Replies Latest reply on Jun 27, 2008 4:52 PM by nohacks

    Rich Faces issue with IE7

    pmohanan

      Hi...All,

      We are using Exadle Studio 4.0 (Ajax)

      We are getting an error message (Line : 375 Error : Object expected)
      in one of the screen when the user hits a button :
      <input id="_idJsp0:clientcode" name="_idJsp0:clientcode" type="text" value="648" maxlength="5" size="5" class="FrmNormalType" tabindex="1" onblur="A4J.AJAX.Submit('_idJsp0:reg1','_idJsp0',event,{'eventsQueue':'clicodequeue','parameters':{'_idJsp0:cn':'_idJsp0:cn'} ,'actionUrl':'/eFiling/jsp/forms/searchHR.jsf','ignoreDupResponses':true} )" />



      When I debugged it using MS debugger , Here is the line that I get error

      <input id="_idJsp0:_idJsp25" name="_idJsp0:_idJsp25" type="submit" value=" &lt;&lt; Search &gt;&gt;" onclick="if(typeof window.clearFormHiddenParams__idJsp0!='undefined'){clearFormHiddenParams__idJsp0('_idJsp0');}if(typeof window.getScrolling!='undefined'){oamSetHiddenInput('_idJsp0','autoScroll',getScrolling());}" class="FormSubmit" />


      This works fine in IE 6 , Firefox etc. and was also working in the earlier version on IE 7.

      Can you please tell me is there a know issue with Ajax & IE7 ?

      Regards,

      P

        • 1. Re: Rich Faces issue with IE7
          budoray

          I am experiencing like problems and have found that this happens with IE7 hotfix 947864. All is well if I remove this update. I have tried to disable the native XMLHttp in my browser to no avail.

          Do we have any other options?

          I'm using 3.1.5GA.

          • 2. Re: Rich Faces issue with IE7
            ilya_shaikovsky

            did you able to probide sample for us?

            I use IE 7 with all updates and has no such errors in my environment.

            • 3. Re: Rich Faces issue with IE7
              budoray

              I will create a small project tonight to demonstrate this bug. I use Firefox at the house, but we have to use IE for work. In the meantime, I can confirm that the action method is called and that I see no javascript errors. Page simply refuses to navigate.

              • 4. Re: Rich Faces issue with IE7
                ilya_shaikovsky

                Do you trying to navigate using ajax components?

                Are you sure you do not forget to define the navigation case as redirect? You have to do it using navigation after ajax request. And in general why do you need ajax if you should perform navigation?

                • 5. Re: Rich Faces issue with IE7
                  budoray

                  Here's the code. I'm using the jars from the 3.1.5 demo download with myfaces 1.1.5 and tomahawk 1.1.6. I could always send you the war file if you request. I deployed this to JBoss 4.0.5GA and OC4J 10. I tested against Firefox and all works well. I test with IE6 and all is well. I test with a fully patched IE7 and can not move beyond the people page. I remove the mentioned patch and it works just fine.

                  public class Person {
                   private int id;
                  
                   private String firstName;
                   private String lastName;
                  
                   /**
                   * Default constructor
                   */
                   public Person(){
                  
                   }
                  
                   /**
                   * @return the id
                   */
                   public int getId() {
                   return id;
                   }
                  
                   /**
                   * @param id the id to set
                   */
                   public void setId(int id) {
                   this.id = id;
                   }
                  
                   /**
                   * @return the firstName
                   */
                   public String getFirstName() {
                   return firstName;
                   }
                  
                   /**
                   * @param firstName the firstName to set
                   */
                   public void setFirstName(String firstName) {
                   this.firstName = firstName;
                   }
                  
                   /**
                   * @return the lastName
                   */
                   public String getLastName() {
                   return lastName;
                   }
                  
                   /**
                   * @param lastName the lastName to set
                   */
                   public void setLastName(String lastName) {
                   this.lastName = lastName;
                   }
                  
                  }
                  
                  public class TestController {
                  
                   private List<Person> people;
                  
                   private int selectedPersonId;
                  
                   private Person selectedPerson;
                  
                   /**
                   * Default constructor
                   */
                   public TestController(){
                   initPeople();
                   }
                  
                   public String goPeople(){
                   return "nav_people";
                   }
                  
                   public String goPersonInfo(){
                   return "nav_person_info";
                   }
                  
                   /**
                   *
                   */
                   private void initPeople(){
                   people = new ArrayList<Person>();
                  
                   for(int i=0; i<10; i++){
                   Person p = new Person();
                   p.setId(i);
                   p.setFirstName("First " + i);
                   p.setLastName("Last " + i);
                  
                   people.add(p);
                   }
                   }
                  
                   /**
                   * @return the people
                   */
                   public List<Person> getPeople() {
                   return people;
                   }
                  
                   /**
                   * @return the selectedPersonId
                   */
                   public int getSelectedPersonId() {
                   return selectedPersonId;
                   }
                  
                   /**
                   * @param selectedPersonId the selectedPersonId to set
                   */
                   public void setSelectedPersonId(int selectedPersonId) {
                   this.selectedPersonId = selectedPersonId;
                  
                   for (Person p : people) {
                   if(p.getId() == selectedPersonId){
                   selectedPerson = p;
                   break;
                   }
                   }
                   }
                  
                   /**
                   * @return
                   */
                   public Person getSelectedPerson(){
                   return selectedPerson;
                   }
                  
                  }
                  
                  *** managed-beans.xml ***
                  <?xml version="1.0" encoding="UTF-8"?>
                  <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
                  
                  <faces-config>
                  
                   <managed-bean>
                   <managed-bean-name>TEST</managed-bean-name>
                   <managed-bean-class>com.test.TestController</managed-bean-class>
                   <managed-bean-scope>session</managed-bean-scope>
                   </managed-bean>
                  
                  </faces-config>
                  
                  *** navigation-rules.xml ***
                  <?xml version="1.0" encoding="UTF-8"?>
                  <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
                  
                  <faces-config>
                  
                   <navigation-rule>
                   <from-view-id>*</from-view-id>
                  
                   <navigation-case>
                   <from-outcome>nav_people</from-outcome>
                   <to-view-id>/people.jsp</to-view-id>
                   </navigation-case>
                  
                   <navigation-case>
                   <from-outcome>nav_person_info</from-outcome>
                   <to-view-id>/personInfo.jsp</to-view-id>
                   </navigation-case>
                  
                   </navigation-rule>
                  
                  </faces-config>
                  
                  *** people.jsp ***
                  <%@ page session="false" contentType="text/html;charset=utf-8"%>
                  <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
                  <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
                  <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
                  <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
                  <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
                  
                  <html>
                  
                   <f:view>
                  
                   <t:documentHead>
                   <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8">
                   </t:documentHead>
                  
                   <t:documentBody>
                  
                   <h:form id="testForm">
                  
                   <rich:dataTable border="0" var="person" value="#{TEST.people}">
                  
                   <f:facet name="header">
                   <rich:columnGroup>
                   <rich:column>
                   <t:outputText value="People" />
                   </rich:column>
                   </rich:columnGroup>
                   </f:facet>
                  
                   <rich:column>
                   <a4j:commandLink action="#{TEST.goPersonInfo}"
                   value="#{people.firstName} #{person.lastName}">
                   <a4j:actionparam name="selectedPersonId" value="#{person.id}"
                   assignTo="#{TEST.selectedPersonId}" />
                   </a4j:commandLink>
                   </rich:column>
                  
                   </rich:dataTable>
                  
                   </h:form>
                  
                   </t:documentBody>
                  
                   </f:view>
                  
                  </html>
                  
                  *** personInfo.xml ***
                  <%@ page session="false" contentType="text/html;charset=utf-8"%>
                  <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
                  <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
                  <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
                  <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
                  <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
                  
                  <html>
                  
                   <f:view>
                  
                   <t:documentHead>
                   <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8">
                   </t:documentHead>
                  
                   <t:documentBody>
                  
                   <h:form id="testForm">
                   <t:panelGrid columns="1">
                   <t:outputText value="#{TEST.selectedPerson.id}" />
                   <t:outputText value="#{TEST.selectedPerson.firstName}" />
                   <t:outputText value="#{TEST.selectedPerson.lastName}" />
                   <t:commandLink action="#{TEST.goPeople}" value="Go People" />
                   </t:panelGrid>
                   </h:form>
                  
                   </t:documentBody>
                  
                   </f:view>
                  
                  </html>
                  
                  *** web.xml ***
                  <?xml version="1.0" encoding="UTF-8"?>
                  <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
                   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
                  
                   <description>Ray's Test Bed</description>
                  
                   <display-name>Test Bed</display-name>
                  
                   <context-param>
                   <param-name>javax.faces.CONFIG_FILES</param-name>
                   <param-value>
                   /WEB-INF/managed-beans.xml, /WEB-INF/navigation-rules.xml
                   </param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
                   <param-value>
                   org.apache.myfaces.component.html.util.StreamingAddResource
                   </param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>
                   org.apache.myfaces.COMPRESS_STATE_IN_SESSION
                   </param-name>
                   <param-value>false</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                   <param-value>server</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>
                   org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION
                   </param-name>
                   <param-value>20</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>
                   org.apache.myfaces.SERIALIZE_STATE_IN_SESSION
                   </param-name>
                   <param-value>false</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>org.apache.myfaces.validate</param-name>
                   <param-value>true</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>
                   org.apache.myfaces.CHECK_EXTENSIONS_FILTER
                   </param-name>
                   <param-value>true</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS</param-name>
                   <param-value>true</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
                   <param-value>false</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
                   <param-value>true</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
                   <param-value>true</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
                   <param-value>true</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name>
                   <param-value>/faces/myFacesExtensionResource</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>com.sun.faces.validateXml</param-name>
                   <param-value>true</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>com.sun.faces.verifyObjects</param-name>
                   <param-value>true</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>org.richfaces.SKIN</param-name>
                   <param-value>blueSky</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
                   <param-value>true</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>org.ajax4jsf.COMPRESS_STYLE</param-name>
                   <param-value>false</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>org.richfaces.LoadScriptStrategy</param-name>
                   <param-value>DEFAULT</param-value>
                   </context-param>
                  
                   <filter>
                   <display-name>Ajax4jsf Filter</display-name>
                   <filter-name>ajax4jsf</filter-name>
                   <filter-class>org.ajax4jsf.Filter</filter-class>
                   </filter>
                  
                   <filter-mapping>
                   <filter-name>ajax4jsf</filter-name>
                   <servlet-name>Faces Servlet</servlet-name>
                   <dispatcher>FORWARD</dispatcher>
                   <dispatcher>REQUEST</dispatcher>
                   <dispatcher>INCLUDE</dispatcher>
                   <dispatcher>ERROR</dispatcher>
                   </filter-mapping>
                  
                   <filter>
                   <filter-name>extensionsFilter</filter-name>
                   <filter-class>
                   org.apache.myfaces.component.html.util.ExtensionsFilter
                   </filter-class>
                   <init-param>
                   <param-name>maxFileSize</param-name>
                   <param-value>20m</param-value>
                   </init-param>
                   </filter>
                  
                   <filter-mapping>
                   <filter-name>extensionsFilter</filter-name>
                   <url-pattern>*.jsf</url-pattern>
                   </filter-mapping>
                  
                   <filter-mapping>
                   <filter-name>extensionsFilter</filter-name>
                   <url-pattern>/faces/*</url-pattern>
                   </filter-mapping>
                  
                   <servlet>
                   <servlet-name>Faces Servlet</servlet-name>
                   <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                   <load-on-startup>1</load-on-startup>
                   </servlet>
                  
                   <servlet-mapping>
                   <servlet-name>Faces Servlet</servlet-name>
                   <url-pattern>*.jsf</url-pattern>
                   </servlet-mapping>
                  
                   <welcome-file-list>
                   <welcome-file>index.jsp</welcome-file>
                   </welcome-file-list>
                  
                  </web-app>
                  
                  *** index.jsp ***
                  <%@ page session="false" contentType="text/xml;charset=utf-8"%>
                  
                  <%
                   response.sendRedirect("people.jsf");
                  %>
                  
                  
                  


                  • 6. Re: Rich Faces issue with IE7
                    pmohanan

                    Here is the code that was written for a button :
                    <h:commandButton action="#{hrDataViewBean.searchHr}"
                    disabled="#{navigatorBean.userRole!='CLIENTUSER' && navigatorBean.userRole!='MATRIXUSER'}"
                    type="submit" styleClass="FormSubmit" value=" << Search >>" />


                    This is how it looks in the HTML when rendered:

                    <input id="_idJsp0:_idJsp25" name="_idJsp0:_idJsp25" type="submit" value="&lt;&lt; Search &gt;&gt;" onclick="if(typeof window.clearFormHiddenParams__idJsp0!='undefined'){clearFormHiddenParams__idJsp0('_idJsp0');}if(typeof window.getScrolling!='undefined'){oamSetHiddenInput('_idJsp0','autoScroll',getScrolling());}" class="FormSubmit" />


                    And Here is the code that throws the Javascript error :
                    <!-- MYFACES JAVASCRIPT -->

                    <!--

                    function getScrolling()
                    {
                    var x = 0; var y = 0;if (self.pageXOffset || self.pageYOffset)
                    {
                    x = self.pageXOffset;
                    y = self.pageYOffset;
                    }
                    else if ((document.documentElement && document.documentElement.scrollLeft)||(document.documentElement && document.documentElement.scrollTop))
                    {
                    x = document.documentElement.scrollLeft;
                    y = document.documentElement.scrollTop;
                    }
                    else if (document.body)
                    {
                    x = document.body.scrollLeft;
                    y = document.body.scrollTop;
                    }
                    return x + "," + y;
                    }

                    //-->

                    • 7. Re: Rich Faces issue with IE7
                      pmohanan

                      Not sure why the JS is not visible :


                      function getScrolling()
                      {
                      var x = 0; var y = 0;if (self.pageXOffset || self.pageYOffset)
                      {
                      x = self.pageXOffset;
                      y = self.pageYOffset;
                      }
                      else if ((document.documentElement && document.documentElement.scrollLeft)||(document.documentElement && document.documentElement.scrollTop))
                      {
                      x = document.documentElement.scrollLeft;
                      y = document.documentElement.scrollTop;
                      }
                      else if (document.body)
                      {
                      x = document.body.scrollLeft;
                      y = document.body.scrollTop;
                      }
                      return x + "," + y;
                      }

                      • 8. Re: Rich Faces issue with IE7
                        ilya_shaikovsky

                        One more time. add

                        <redirect/>
                        tag to your navigation case.

                        Create jira issue and attach the war if not helps.

                        • 9. Re: Rich Faces issue with IE7
                          budoray

                          Fair enough, but what if I'm request scope and not session scope? I have an existing code base where the previous developers chose to make everything request scope ... afraid to use session I suppose ... and use the myfaces t:saveState tag everywhere. I'd love to make everything session based with redirect in the navigation, but that's a huge change with the code base.

                          However, I'm more than happy to go forward with changing it all to session scope, removing the saveState tags, and using the redirect markup in my navigation xml if this is the only thing that is breaking a4j with the IE7 update I mentioned.

                          It would also be nice to have an explanation on why the hotfix breaks the ajax functionality. Ideally, we would simply use Firefox and be done with it, but those decisions were made before me and won't likely change any time soon.

                          'One more time', thanks again for your help. Support is a rough job and I understand that the fuse is short at times.

                          • 10. Re: Rich Faces issue with IE7
                            ilya_shaikovsky

                            If this isn't too complex for you please send me sample war instead of pasting the code there.

                            • 11. Re: Rich Faces issue with IE7
                              budoray

                              I modified my test code to use <t:saveState> and it doesn't appear to be a problem. Here's the modifies pieces.

                              
                              *** TestController.java ***
                              /**
                               * @param selectedPersonId the selectedPersonId to set
                               */
                               public void setSelectedPersonId(int selectedPersonId) {
                               this.selectedPersonId = selectedPersonId;
                               }
                              
                               /**
                               * @return
                               */
                               public Person getSelectedPerson(){
                               for (Person p : people) {
                               if(p.getId() == selectedPersonId){
                               selectedPerson = p;
                               break;
                               }
                               }
                               return selectedPerson;
                               }
                              
                              *** people.jsp ***
                              
                               <t:saveState id="selectedPersonId" value="#{TEST.selectedPersonId}" />
                              
                              *** managed-beans.xml ***
                              
                              <managed-bean>
                               <managed-bean-name>TEST</managed-bean-name>
                               <managed-bean-class>com.test.TestController</managed-bean-class>
                               <managed-bean-scope>request</managed-bean-scope>
                               </managed-bean>
                              
                              


                              • 12. Re: Rich Faces issue with IE7
                                budoray

                                 

                                
                                *** navigation-rules.xml ***
                                
                                <navigation-case>
                                 <from-outcome>nav_people</from-outcome>
                                 <to-view-id>/people.jsp</to-view-id>
                                 <redirect />
                                 </navigation-case>
                                
                                 <navigation-case>
                                 <from-outcome>nav_person_info</from-outcome>
                                 <to-view-id>/personInfo.jsp</to-view-id>
                                 <redirect />
                                 </navigation-case>
                                
                                


                                • 13. Re: Rich Faces issue with IE7
                                  budoray

                                  Well, with the change in my java code, I don't even need to use the t:saveState tag at all.

                                  I think I will still make the argument for making the controllers session based just so that they don't have to be recreated between requests.

                                  “Had a slight weapons malfunction, but everything's perfectly alright now. We're fine, we're all fine, here, now, thank you. How are you?�

                                  --Han Solo

                                  • 14. Re: Rich Faces issue with IE7

                                    Hi budoray,

                                    Did you find a fix for your request beans??

                                    I have a similar issue and can't change my request beans into session beans. I have a transactional site and that would not be very good for memory management.

                                    Fair enough, but what if I'm request scope and not session scope? I have an existing code base where the previous developers chose to make everything request scope ... afraid to use session I suppose ... and use the myfaces t:saveState tag everywhere. I'd love to make everything session based with redirect in the navigation, but that's a huge change with the code base.


                                    Thanks
                                    Phil