really strange a4j:support enabled (onclick rerender) checkb
kei060 Oct 2, 2008 7:12 AMThis 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>