10 Replies Latest reply on Apr 19, 2006 3:29 AM by kh2ouija

    Seam outjection problem, is this a bug?

    kh2ouija

      Hi.

      I have a SFSB Seam component ShowItems which has:

      @DataModel
      private List<Item> items;
      
      @DataModelSelection
      @Out(required = false)
      private Item selectedItem;
      


      I display the items with a h:dataTable and when the user clicks on an item he's redirected to a itemDetails page where I have stuff like:
      #{selectedItem.name} #{selectedItem.description}

      These show blank! as if selectedItem is null. But looking in the debugger I see that in fact it's not.

      I added this method on the SFSB:

      public String nothing() {
       return null;
      }


      and put a h:commandLink on the itemDetails page, with action=showItems.nothing. The page shows blank but after clicking on this link (which does nothing other than return to the same page) the selectedItem component is now visible to the page, like it has only now been outjected.


      I found a workaround. If I add a getSelectedWebsite() method on the SFSB, then modify the page like this:

      #{showItems.selectedItem.name} #{selectedItem.description}


      Both name and description appear! It seems the component is outjected only after it is read by the first call to getSelectedItem(). But it doesn't seem right to do.

      Does anyone have any idea what's wrong here? Thank you.