5 Replies Latest reply on Sep 26, 2007 4:43 AM by Ilya Shaikovsky

    switchToState of rich:toggleControl  does not work

    Haohua xie Newbie

      I am trying to create a wizard for data input.
      I try to do so, using rich:toggleControl and rich:toggleControl
      but when switchToState of rich:toggleControl is set , an java.lang.IllegalArgumentException is throw. So i copy some example code from RichFaces Developer Guide
      it does not work too. I search in jira and find no related topic. Is this a bug?

      here is my sample code

      
      <%@ page language="java" contentType="text/html; charset=UTF-8"
       pageEncoding="UTF-8"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
      
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>??????</title>
      <link href="../../css/common.css" rel="stylesheet" type="text/css">
      </head>
      <body>
      <f:view>
       <h:form id="helloForm">
      
       <rich:togglePanel id="panel" initialState="empty" switchType="client">
      
       <f:facet name="first">
      
       <h:panelGroup>
      
       <rich:toggleControl for="helloForm:panel" value="Empty "
       switchToState="empty" />
      
       <rich:toggleControl for="helloForm:panel" value=" Second"
       switchToState="second" />
      
       ...//Some Content
      
       </h:panelGroup>
      
       </f:facet>
      
       <f:facet name="second">
      
       <h:panelGroup>
      
       <rich:toggleControl for="helloForm:panel" value="Empty "
       switchToState="empty" />
      
       <rich:toggleControl for="helloForm:panel" value=" first"
       switchToState="first" />
      
       ...//Some Content
      
       </h:panelGroup>
      
       </f:facet>
      
       <f:facet name="empty">
      
       <h:panelGroup>
      
       <rich:toggleControl for="helloForm:panel" value="first "
       switchToState="first" />
      
       <rich:toggleControl for="helloForm:panel" value=" second"
       switchToState="second" />
      
       </h:panelGroup>
      
       </f:facet>
      
       </rich:togglePanel>
       </h:form>
      </f:view>
      </body>
      </html>
      


      the blue text is completely copied from RichFaces Developer Guide, Chapter 6.69
      I have try to remove all for="helloForm:panel" , it does't work either;
      Any one can help?

        • 1. Re: switchToState of rich:toggleControl  does not work
          Haohua xie Newbie

          here is the stack trace

          Stack Trace?
          java.lang.IllegalArgumentException: Component j_id_jsp_407121277_4 attribute switchToState must be a value reference, was empty
          at org.ajax4jsf.webapp.taglib.UIComponentTagBase.setValueBinding(UIComponentTagBase.java:375)
          at org.richfaces.taglib.ToggleControlTag.setProperties(ToggleControlTag.java:977)
          at javax.faces.webapp.UIComponentTag.createComponent(UIComponentTag.java:209)
          at javax.faces.webapp.UIComponentClassicTagBase.createChild(UIComponentClassicTagBase.java:476)
          at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:660)
          at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1111)
          at org.apache.jsp.pages.rating.test_jsp._jspx_meth_rich_005ftoggleControl_005f0(test_jsp.java:347)
          at org.apache.jsp.pages.rating.test_jsp._jspx_meth_h_005fpanelGroup_005f0(test_jsp.java:304)
          at org.apache.jsp.pages.rating.test_jsp._jspx_meth_f_005ffacet_005f0(test_jsp.java:265)
          at org.apache.jsp.pages.rating.test_jsp._jspx_meth_rich_005ftogglePanel_005f0(test_jsp.java:217)
          at org.apache.jsp.pages.rating.test_jsp._jspx_meth_h_005fform_005f0(test_jsp.java:169)
          at org.apache.jsp.pages.rating.test_jsp._jspx_meth_f_005fview_005f0(test_jsp.java:126)
          at org.apache.jsp.pages.rating.test_jsp._jspService(test_jsp.java:89)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
          at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
          at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
          at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
          at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
          at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
          at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
          at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
          at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
          at de.mindmatters.faces.lifecycle.RenderResponsePhase.executePhase(RenderResponsePhase.java:45)
          at de.mindmatters.faces.lifecycle.AbstractPhase.execute(AbstractPhase.java:37)
          at de.mindmatters.faces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:166)
          at de.mindmatters.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:226)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
          at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
          at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          at java.lang.Thread.run(Thread.java:595)
          
          


          • 2. Re: switchToState of rich:toggleControl  does not work
            Haohua xie Newbie

            my work aroud:
            i add stateOrder to rich:togglePanel and remove switchToState of rich:toggleControl, and it works. but i can't jump to the speficied step and my users have to go through all the steps be fore submit their data, which is not necessary

            • 3. Re: switchToState of rich:toggleControl  does not work
              Haohua xie Newbie

              i found that if the facet name is stored in an attribute of a managed bean, the toggleControl works fine