4 Replies Latest reply on Jan 5, 2011 6:50 AM by nur

    Simple @In and @Out

    nur

      Hello all.


      I had a xhtml with a list of person and when i click on one person of the list i'm redirected to detail view for this person.
      Then I have 2 pages: personList.xhtml and personView.xhtml.
      Each page have a backingbean: personListBean.java and personViewBean.java


      My link redirection on personList.xhtml look like:


      <h:commandLink action="#{personneListBean.selectEntity(_personne)}">
           <h:outputText value="#{_personne.id}" />
      </h:commandLink>



      In my personneListBean I have:



      @Out(required = false)
      private Person selectedPerson;
      
      public void selectEntity(Person p) {
           System.out.println("p: " + p.getNom());
           selectedPerson = p;
           System.out.println("selectedPerson: " + selectedPerson.getNom());
      }



      And when i click on a row i see in console:


      11:03:09,876 INFO  [STDOUT] p: Lefebvre
      11:03:09,876 INFO  [STDOUT] selectedPerson: Lefebvre



      Then i know my code is executed and selectedPersonne is not null.


      In personViewBean.java I have:



      @In
      private Person selectedPerson;
      
      + getter and setter



      But when i click on a row my personView.xhtml fall in error:



      Caused by: org.jboss.seam.RequiredException: @In attribute requires non-null value: personneViewBean.selectedPerson




      How can i make it's work?


      thx







        • 1. Re: Simple @In and @Out
          aareshchanka

          What is the scope of you personViewBean?
          Try Conversation,
          try add @Begin to setter method, or even create another method for initialization not to intercept with setters that will be called on xhtml page.


          And don't forget to end conversation.

          • 2. Re: Simple @In and @Out
            nur

            Thx for your answer.


            The scope was Page but it's the same with Conversation.


            I have add @Begin and @End but yet same problem..


            All personViewBean code:pastebin


            I don't see what you want want say with



            even create another method for initialization not to intercept with setters that will be called on xhtml page.
            • 3. Re: Simple @In and @Out
              nur

              When i use


              @In(create = true)



              I don't have any error my it's open new Person, not the selected in table


              • 4. Re: Simple @In and @Out
                nur

                Ok it's work now.


                I change the name of the variable @In and @Out selectedPerson by the name on the @name on entity Person


                And change the scope of personListBean to conversation