2 Replies Latest reply on Jan 12, 2010 2:47 PM by Piotr Salski

    RequestParameter issue null value

    Piotr Salski Newbie

      I'm having problem with RequestParameter passing


      <h:outputFormat value="#{SetW.who3}">
         <f:param name="pary" value="some string"/>
      </h:outputFormat>




      my bean


      @Name("SetW")
      public class SetWhos {
           
            private String who3;
      
            @RequestParameter("pary")
            private String pary;
            
            public String getWho3() 
            {
                System.out.println("c1_" + pary);
                who3 = "My parameter" + pary;
            }     
           
            return who3;
      }
      



      the pary variable from xhtnl is not passed to the bean, it is always null.


      Anybody knows why?





        • 1. Re: RequestParameter issue null value
          Piotr Salski Newbie

          Does it true that f:param works on h:commandLink and h:outputLink only. If so, how can I pass parameter to backing bean from xhtml outputtext?
          I have three values that I can display in outputtext using

          <h:outputFormat value="{0}{1}{2}{3}">
                   <f:param value="#{event.single}"/>
                   <f:param value="#{event.couple}"/>
                   <f:param value="#{event.children}"/>
                   <f:param value="#{event.groups}"/>
          </h:outputFormat>


          but I need to format those 3 values in one string with some additional text depending on these vales. So how can I use bean from above to format outputtext


          • 2. Re: RequestParameter issue null value
            Piotr Salski Newbie

            I found solution :) Maybe this post will be helpfull for someone


            We need outputtext


            <h:outputText binding="#{SetW.text}" value="#{SetW.textValue}" >
                     <f:attribute name="attributename" value="#{event.city}" />
                 <f:attribute name="attributename1" value="#{event.eventname}" />
            </h:outputText>



            and backing bean


            @Name("SetW")
            public class SetWhos {
            
                 private HtmlOutputText text;
            
                 public HtmlOutputText getText() {
                      return text;
                 }
            
               public String getTextValue() {
                    return (String) text.getAttributes().get("attributename") +
                    (String) text.getAttributes().get("attributename1");
                }
                 
                 public void setText(HtmlOutputText text) {
                      this.text = text;
                 }     
                 
            }
            



            GREAT!!!