4 Replies Latest reply on Nov 18, 2008 6:00 AM by ilya_shaikovsky

    really strange a4j:support enabled (onclick rerender) checkb

    kei060

      This following code works brilliantly when i dont add the facelets -jars and -filter to my web.xml and adding view handler to faces-config.xml. But in conjunction with facelets, when clicking on the checkbox, it does not rerender the output text. i have to first click the checkbox, and then force rerendering by clicking the "FORCE RERENDER" button to get the desired effect.

      <h:form id="form">
       <h:selectBooleanCheckbox value="#{testBean.bool}">
       <a4j:support event="onclick" bypassUpdates="false" ajaxSingle="true"/>
       </h:selectBooleanCheckbox>
      
       <a4j:commandButton value="FORCE RERENDER" id="button" />
      
       <a4j:outputPanel ajaxRendered="true">
       <h:outputText value="#{testBean.bool}" />
       </a4j:outputPanel>
      </h:form>
      


      my test case system is currently tomcat 5.5 with jsf 1.2 mojarra implementation, richfaces 3.2.2 and facelets 1.1.14. I have also tried tomcat 6 with no luck.

      does anyone have any idea's of what might be causing this?

      faces-config.xml
      
      <?xml version="1.0" encoding="UTF-8"?>
      
      <faces-config
       xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
       version="1.2">
       <application>
       <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
       </application>
       <managed-bean>
       <managed-bean-name>testBean</managed-bean-name>
       <managed-bean-class>TestBean</managed-bean-class>
       <managed-bean-scope>request</managed-bean-scope>
       </managed-bean>
      </faces-config>
      


      web.xml
      
      <?xml version="1.0" encoding="UTF-8"?>
      <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
       <display-name>checkbox_problem</display-name>
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
       </context-param>
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
       </context-param>
       <context-param>
       <param-name>facelets.SKIP_COMMENTS</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <listener>
       <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
       </listener>
       <filter>
       <display-name>RichFaces Filter</display-name>
       <filter-name>richfaces</filter-name>
       <filter-class>org.ajax4jsf.Filter</filter-class>
       </filter>
       <filter-mapping>
       <filter-name>richfaces</filter-name>
       <servlet-name>Faces Servlet</servlet-name>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       </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>*.xhtml</url-pattern>
       </servlet-mapping>
      </web-app>
      


      WEB-INF/lib
      
      commons-beanutils-1.8.0.jar
      commons-collections-3.2.1.jar
      commons-digester-1.8.jar
      commons-logging-1.1.1.jar
      el-api-1.0.jar
      el-impl-1.0.jar
      jsf-api-1.2_04-p02.jar
      jsf-api.jar
      jsf-facelets.jar
      jsf-impl.jar
      jstl-1.2.jar
      jstl.jar
      portlet.jar
      richfaces-api-3.2.2.GA.jar
      richfaces-impl-3.2.2.GA.jar
      richfaces-ui-3.2.2.GA.jar
      standard.jar
      


      TestBean.java
      
      
      public class TestBean {
       private boolean bool = false;
      
       public void setBool(boolean bool) {
       this.bool = bool;
       }
      
       public boolean isBool() {
       return bool;
       }
      }
      
      


      test.xhtml
      
      <?xml version="1.0" encoding="UTF-8" ?>
      <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:a4j="http://richfaces.org/a4j">
       <ui:composition>
       <h:form id="form">
       <h:selectBooleanCheckbox value="#{testBean.bool}">
       <a4j:support event="onclick" bypassUpdates="false" ajaxSingle="true" />
       </h:selectBooleanCheckbox>
       <a4j:commandButton value="FORCE RERENDER" id="button" />
       <a4j:outputPanel ajaxRendered="true">
       <h:outputText value="#{testBean.bool}"/>
       </a4j:outputPanel>
       </h:form>
       </ui:composition>
      </jsp:root>
      


        • 1. Re: really strange a4j:support enabled (onclick rerender) ch
          ilya_shaikovsky

          could you please also paste a4j:log output for the checkbox request only?

          • 2. Re: really strange a4j:support enabled (onclick rerender) ch
            kei060

            the a4j:log does not output anything for the checkbox request. it is like the event handler isn't assosciated with the checkbox at all..

            here's the source code for the outputted html document.

            <html xmlns="http://www.w3.org/1999/xhtml"><head><link class='component' rel='stylesheet' type='text/css' href='/chekbox_problem5.5/a4j/s/3_2_2.GAorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_.xhtml;jsessionid=853AAE31A0D7B7DC557F2643AC91FDB0' /><link class='component' rel='stylesheet' type='text/css' href='/chekbox_problem5.5/a4j/s/3_2_2.GAorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_.xhtml;jsessionid=853AAE31A0D7B7DC557F2643AC91FDB0' media='rich-extended-skinning' /><script type='text/javascript' src='/chekbox_problem5.5/a4j/g/3_2_2.GAorg.ajax4jsf.javascript.AjaxScript.xhtml'></script><script type='text/javascript'>window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script><script type='text/javascript' src='/chekbox_problem5.5/a4j/g/3_2_2.GAorg/richfaces/renderkit/html/scripts/skinning.js.xhtml'></script></head><form id="form" name="form" method="post" action="/chekbox_problem5.5/test.xhtml;jsessionid=853AAE31A0D7B7DC557F2643AC91FDB0">
            <input type="hidden" name="form" value="form" />
            <div id="logConsole" style="width:800;height:600;overflow:auto;width: 800px; height: 300px;"><button onclick="LOG.clear()">Clear</button><br /><script type="text/javascript">LOG.LEVEL = LOG.ALL;</script></div><input type="checkbox" name="form:j_id1" /><input id="form:button" name="form:button" onclick="A4J.AJAX.Submit('_viewRoot','form',event,{'parameters':{'form:button':'form:button'} ,'actionUrl':'/chekbox_problem5.5/test.xhtml;jsessionid=853AAE31A0D7B7DC557F2643AC91FDB0'} );return false;" value="FORCE RERENDER" type="button" /><span id="form:j_id3">false</span><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id1" />
            </form></html>
            


            • 3. Re: really strange a4j:support enabled (onclick rerender) ch

              I seem to be having a similar problem. Using RF 3.2.2.SR1 and jsf-facelets 1.1.14 with tomahawk 1.1.8.

              The value gets submitted okay but the reRender option doesn't get invoked... Was there a reason for this?

              Unable to migrate to maven due to requirements.

              Did anyone find a way to solve this?

              • 4. Re: really strange a4j:support enabled (onclick rerender) ch
                ilya_shaikovsky

                guys.. please send me war sample somebody if you able and I'll post the answer after correction or rise the jira issue if needed.

                B.t.w. still cant reproduce under local projects. :(