0 Replies Latest reply on Oct 31, 2007 7:57 AM by Thomas Frössman

    @unwrap that manages backing beans...

    Thomas Frössman Newbie

      Hello, I would like to manage access to multiple instances of backing beans .

      I would like something like this but working.

      @Name("perCellForm")
      public class PerCellFormBean implements PerCellForm {
      
       HashMap<Long, FormAction> cells = new HashMap<Long, FormAction>(10);
      
       @In
       private Cell currentCell;
      
       @Unwrap
       public FreeAction getCell() {
      
       if (cells.containsKey(currentCell.getId())) {
       return cells.get(currentCell.getId());
       } else {
      
       Object component = Component.getInstance("FormAction", true);
      
       cells.put(currentCell.getId(), (FormAction) component);
       return (FormAction) component;
       }
       }
      
       @Destroy
       @Remove
       public void remove() {
      
       }
      }
      


      Object component = Component.getInstance("FormAction", true);
      Obviously doesn't work since the component only will be created once and then just re-gotten from the conversation context.

      Is it possible to do a manager such as this with seam?

      I need to be able to dynamically assign multiple instances of stateful backing beans for forms.

      I need seam to actually instantiate multiple instances and be able to hold references to them, how do I do that?