4 Replies Latest reply on Sep 21, 2007 8:04 AM by pmuir

    Page parameter with h:commandlink

    nemya

      Hi,
      I have an

      <s:link view="/Page.xhtml">
       <f:param name="realise" value="true" />
      </s:link>


      The Page.xhtml has a backing Statefull Bean (Conversation scope) with an attribute with its getter and setter:
      @RequestParameter("realise")
      private boolean realise;


      I have a method in this bean which prints on the console "realise" value.

      When I click on the s:link the page Page.xhtml shows up correctly and the "realise" value is printed on the console.
      When I click on any s:link on Page.xhtml redirecting to the same page everything is Ok.
      But when I click on any h:commandlink with an action or s:link with an action i'm redirected to debug page with this exception:
      Could not set field value by reflection: MyBean.realise on: MyPackage.MyBean with null value

      I also put an f:param in the commandlink but noway!
      What is the problem?
      Using Jboss Seam 1.2.1.GA + JBoss Server 4.0.5.GA

        • 1. Re: Page parameter with h:commandlink
          nemya

          I changed my attribute type from boolean to Boolean

          @RequestParameter("realise")
          private boolean realise;

          I have a nullPointerException every time I call a method using this "realise" attribute with my h:commandlink

          • 2. Re: Page parameter with h:commandlink

            try

            <s:link view="/Page.xhtml">
             <f:param name="realise" value="#{true}" />
            </s:link>
            


            • 3. Re: Page parameter with h:commandlink
              nemya

              The problem isn't on there. That s:link works fine. The problem is when I try to call a method from the bean that contains the @RequestParameter (method using my "realise" attribute).
              I found a solution to my problem by assigning the "realise" attribute to another attribute in my @Begin @Create Method. And then I invoke only my new attribute and never the "realise" attribute.
              But I still don't understand where my problem comes from.

              • 4. Re: Page parameter with h:commandlink
                pmuir

                The parameter isn't propagated across the redirect by default so the second time it is injected into your bean it isn't there to inject.