2 Replies Latest reply on Feb 24, 2009 11:15 PM by Thai Dang Vu

    Able to inject an event-scoped obj into a conversation-scoped obj?

    Thai Dang Vu Apprentice

      I tried it and grammatically, it's doable, but it doesn't work as I expected. So I'd like to have a confirmation from others.


      Thank you.

        • 2. Re: Able to inject an event-scoped obj into a conversation-scoped obj?
          Thai Dang Vu Apprentice

          I have a conversation-scoped SFSB


          import org.richfaces.component.html.HtmlScrollableDataTable;
          import org.richfaces.model.selection.SimpleSelection;
          
          @Stateful
          @Name("bean")
          public class BeanImpl implements Bean {
              @In("dataTable")
              protected HtmlScrollableDataTable dataTable;
          
              @In("selection")
              protected SimpleSelection selection;
          
              public void viewSelectedRows() {
                  Iterator<Object> iterator = selection.getKeys();
                  .....
              }
          }



          In my components.xml, I have


          <component name="dataTable" class="org.richfaces.component.html.HtmlScrollableDataTable" scope="event"/>
          <component name="selection" class="org.richfaces.model.selection.SimpleSelection" scope="event"/>



          My xhtml


          <rich:scrollableDataTable ... binding="#{dataTable}" selection="#{selection}">
              ....
          </rich>
          <a4j:commandLink value="View selected rows" action="#{bean.viewSelectedRows}" .../>



          I selected some rows in the scrollable data table, clicked the a4j:commandLink to fire the viewSelectedRows method and noticed that the selection was empty.


          Section 7.10 Conversational components and JSF component bindings of the Reference Guide creates an event-scoped object which contains JSF component bindings and then injects that object into a conversation-scoped object. I'll try this way tonight (I've just found it this afternoon). But is there any difference between coding like in section 7.10 and declaring JSF component bindings in components.xml like I did?