1 2 Previous Next 15 Replies Latest reply on Jun 18, 2009 4:52 AM by Ging Ming Chan

    How to pass boolean value to f:param and page param

    Gus Gu Expert

      Hi there,


      I tried to pass a boolean value True/False to f:param and page param, but it failed to work. Anybody can give a guidance? Thank you very much in advance.

      <f:param name="boo" value="True"/>
      <param name="boo" value="#{foo.boo}"/>

        • 1. Re: How to pass boolean value to f:param and page param
          Keith Naas Novice

          Try true instead of True.


          From Value and Method Expressions:



          The unified expression language defines the following literals: ... Boolean: true and false
          • 2. Re: How to pass boolean value to f:param and page param
            Gus Gu Expert


            Try true instead of True.


            Hi Keith, thank you. I tried true, but no fortune. In foo bean, I use object Boolean:

            private Boolean boo;
            public Boolean getBoo() {
                return boo;
            }
            public void setBoo(Boolean boo) {
                this.boo = boo;
            }

            • 3. Re: How to pass boolean value to f:param and page param
              Keith Naas Novice

              S,


              Can you post the the xhtml and xml where you are passing params?


              Thanks.

              • 4. Re: How to pass boolean value to f:param and page param
                Gus Gu Expert

                Thanks, Keith. Code snippets are as follows:

                <page view-id="/test_view.xhtml" conversation-required="true">
                     <param name="boo" value="#{foo.boo}"/>
                </page>
                
                <s:link value="Test View" action="#{foo.viewTest}">
                     <f:param name="boo" value="true"/>
                </s:link>

                • 5. Re: How to pass boolean value to f:param and page param
                  Gus Gu Expert

                  Anybody can give a help? I couldn't found something in my code. Maybe it needs Boolean converter in page param or it is a bug? Thanks.

                  • 6. Re: How to pass boolean value to f:param and page param
                    Keith Naas Novice

                    Another silly thing to try in the s:link would be


                    <s:link value="Test View" action="#{foo.viewTest}">
                         <f:param name="boo" value="#{true}"/>
                    </s:link>



                    Are you comfortable running in a debugger?  You could monitor the value of the boo variable to see what its evaluating to when the link is being built. 

                    • 7. Re: How to pass boolean value to f:param and page param
                      Gus Gu Expert

                      Hi Keith, I ever tried #{true}. When I debugged the value of boo, it always turn out to be false.

                      • 8. Re: How to pass boolean value to f:param and page param
                        Keith Naas Novice

                        Hmmmm....the plot thickens...


                        You've really stumped me on this one, S! 


                        Can you try using an h:commandLink to see if that works correctly?


                        Have you tried using other values for boo such as an integer or string just to see if the issue is isolated to boolean?


                        Keith

                        • 9. Re: How to pass boolean value to f:param and page param
                          Gus Gu Expert

                          Sorry, Keith, In fact, I also passed long param through this s:link, and the long param works. Gus

                          • 10. Re: How to pass boolean value to f:param and page param
                            Pete Muir Master

                            Try using a converter:


                            <param name="foo" value="#{bar.foo}" converter="javax.faces.Boolean" />

                            • 11. Re: How to pass boolean value to f:param and page param
                              Gus Gu Expert

                              Pete Muir wrote on Mar 11, 2008 09:28 PM:


                              Try using a converter:

                              <param name="foo" value="#{bar.foo}" converter="javax.faces.Boolean" />




                              Thanks, Pete. When I used the converter, I always got following exceptions.

                              19:12:36,578 WARN  [Param] could not create converter for: parentEdited
                              java.lang.ClassCastException: java.lang.String
                                      at org.jboss.seam.navigation.Param.getConverter(Param.java:57)
                                      at org.jboss.seam.navigation.Param.getStringValueFromModel(Param.java:143)
                                      at org.jboss.seam.navigation.Pages.getStringValuesFromModel(Pages.java:690)
                                      at org.jboss.seam.ui.component.UISeamCommandBase.getUrl(UISeamCommandBase.java:51)
                                      at org.jboss.seam.ui.renderkit.LinkRendererBase.doEncodeBegin(LinkRendererBase.java:26)
                                      at org.jboss.seam.ui.util.cdk.RendererBase.encodeBegin(RendererBase.java:79)
                                      at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
                                      at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:350)
                                      at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:92)
                                      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                                      at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:539)
                                      at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:543)
                                      at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:543)
                                      at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:543)
                                      at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:543)
                                      at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:543)
                                      at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:543)
                                      at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:286)
                                      at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:161)
                                      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                                      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                                      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                                      at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:18)
                                      at com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:25)
                                      at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:161)
                                      at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet$ThreadBlockingRequestResponse.respondWith(ThreadBlockin
                                      at com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:30)
                                      at com.icesoft.faces.webapp.http.core.SingleViewServer.service(SingleViewServer.java:48)
                                      at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
                                      at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
                                      at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
                                      at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:29)
                                      at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:105)
                                      at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:37)
                                      at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
                                      at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
                                      at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:76)
                                      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.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                                      at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                      at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                      at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42)
                                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
                                      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                                      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                                      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.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                                      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                                      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                                      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:262)
                                      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                                      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                                      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                                      at java.lang.Thread.run(Thread.java:595)

                              • 12. Re: How to pass boolean value to f:param and page param
                                Pete Muir Master

                                Oops, should be converterId="javax.faces.Boolean"

                                • 13. Re: How to pass boolean value to f:param and page param
                                  Gus Gu Expert

                                  Pete Muir wrote on Mar 12, 2008 11:01 AM:


                                  Oops, should be converterId="javax.faces.Boolean"

                                  Hi Pete, No exception now, but param setter failed to be invoked. Do you have some examples about the Boolean page param? Thank you so much.

                                  • 14. Re: How to pass boolean value to f:param and page param
                                    Pablo Lucero Newbie

                                    Pete,



                                    javax.faces.Boolean

                                    don't exist.
                                    I think that he should use



                                    converterId="javax.faces.convert.BooleanConverter"



                                    What do you think?
                                    Best regards.

                                    1 2 Previous Next