0 Replies Latest reply on Sep 29, 2008 11:18 PM by ipazmino

    Injecting components

    ipazmino

      Hi,


      I'm trying to figureout how to design and build a very simple app. Actually is kind of extending the TODO List example. What I want is to add creating and editing TODO messages.


      The list should just list de messages and have the delete button. A create button would be placed over the listing, and, the subject would be a link for edition.


      I believe this app would be designed in two views:
      - todoList.xhtml for the messages list
      - message.xhtml to create/edit a message


      To me, there are two responsibilities:
      - Managing the list. This means, quering the data and providing a list with the elements to display, calling the views where creation and edition takes place, and, deleting a message from the list.
      - Managing the message's actions. Creating new messages and updating them.


      Managing the list, like in the TODO List example, would take place in a stateful bean. Here a @Factory method would load the list and a @DataModelSelection attribute would be helpful to perform the deletion.


      To manage the message's actions, it would be necessary to inject the selected message in a stateless bean with two desired actions.


      How do I inject this selected message here?
      If I move the deleting action to the stateless bean, how do I inject the messages list created by the factory?


      Thanks in advance.