0 Replies Latest reply on Feb 10, 2009 12:55 AM by dolanp.dolanp.gmail.com

    Calling a method on another bean and skipping view

    dolanp.dolanp.gmail.com

      Hello all,


      I have a question that's hopefully simple to solve.  Here is an outline of what I have going on:


      @Stateful
      @Name("logEntry")
      @Scope(ScopeType.SESSION)
      public class LogEntryBean implements LogEntry {
      
          @Out 
          List<TradingPartner> partnerList = new ArrayList<TradingPartner>();
      
          public String rollBack() {
              // some business logic to build a list
      
                  return "/tpImport";
          }
      
      //other stuff
      }
      
      @Stateful
      @Scope(SESSION)
      @Name("tpImport")
      @TransactionManagement(TransactionManagementType.BEAN)
      public class TPImportBean implements TPImport {
          @In
          private List<TradingPartner> partnerList;
      
          public String tpImport()
          { 
             //use the list here
          }
      
      }
      



      There is a view for tpImport.xhtml which is basically a confirmation page which submits to the tpImport() method above and the processing begins.


      What I want is to be able to kick off this processing from the rollBack() method of the other bean, LogEntry.  If I use it as described above, the partnerList object passes between the two classes and the view renders it correctly and the confirmation screen shows as expected.  However I would like to skip the confirmation screen and directly start the tpImport() method.  I've tried various ways of injecting the bean and calling the method, using events, using the session in the FacesContext, etc but I can't figure out a way to call that method and preserve the partnerList object except to let it do a return '/tpImport'; to the view.  I've tried tying it directly to an EL value with the value tag on the @In and @Out but that doesn't work either. Any ideas?


      To put it more succinctly: How can I call a method in another session bean and preserve the outject/inject object that I need?