1 Reply Latest reply on Jun 21, 2007 2:53 PM by bsmithjj

    @Out problem (Seam 1.2.1)

      I'm probably missing something trivial, but I am stuck with an @Out issue and hopefully someone can point something out.

      First, I have a Seam component that is JavaBean; annotated as such:

      @Name("evergreenUser")
      @Roles( {
       @Role(name="accessRequestUser", scope=ScopeType.CONVERSATION),
       @Role(name="userToClone")
      } )
      public class EvergreenUser implements Serializable {
       ...
      }


      I have a method in a SFSB that will, based on the value of a @RequestParameter, here is the relative code:

      @Stateful
      @Name("accessRequestManager2")
      public class AccessRequestManager2Bean implements AccessRequestManager2 {
      
       @Logger
       private Log log;
      
       @PersistenceContext(unitName = "accessControlDatabase")
       private EntityManager em;
      
       @In
       private UserPrincipal userPrincipal;
      
       @In(required = false)
       @Out
       private Integer currentStep;
      
       @In
       private Conversation conversation;
      
       @In(create = true)
       private DraftAccessRequestMaster draftAccessRequestMaster;
      
       @RequestParameter
       private String selectedUserId;
      
       @Out
       private List<String> errors = new ArrayList<String>();
      
       @Out(required = false)
       private EvergreenUser accessRequestUser;
      
       /**
       * Start a new add-access request. This method also generates the conversationId to
       * use in the conversation that beans of this class are associated with.
       */
       @Begin(id = "DraftAccessRequestID:#{draftAccessRequestMaster.id}", join = true)
       public void startAddRequest() {
       log.info("startAddRequest()");
      
       draftAccessRequestMaster.setCurrentStep(
       currentStep = 1
       );
      
       }
      
       /**
       * Step 2.
       * Select user to clone (optional)
       * Select 1-or-more applications and entitlements
       */
       public void editAccessRequestDetails() {
       if (selectedUserId == null) {
       log.error("User not Selected...TODO - bounce back to step 1.");
       }
       log.info("selectedUserId -> " + selectedUserId);
       accessRequestUser = QueryEPeopleUtil.findUserByUid(selectedUserId);
       log.info("accessRequestUser -> " + accessRequestUser);
      
       draftAccessRequestMaster.setCurrentStep(
       currentStep = 2
       );
       }
       ....
      }


      And I use an <s:link ... /> tag to call editAccessRequestDetails()

       <s:link value="#{eUser.name}"
       action="#{accessRequestManager2.editAccessRequestDetails}" propagation="join">
       <f:param value="#{eUser.anumber}" name="selectedUserId"/>
       </s:link>
      


      I also have a navigation rule in pages.xml so that when editAccessRequestDetails() is called, another page is displayed

       <page view-id="/user_access_request_step_1.xhtml">
       <navigation from-action="#{accessRequestManager2.editAccessRequestDetails}"
       evaluate="#{draftAccessRequestMaster.currentStep}">
       <rule if-outcome="1">
       <redirect view-id="/user_access_request_step_1.xhtml"/>
       </rule>
       <rule if-outcome="2">
       <redirect view-id="/user_access_request_step_2.xhtml"/>
       </rule>
       </navigation>
       <navigation from-action="#{accessRequestManager2.cancel}">
       <redirect view-id="/index.xhtml"/>
       </navigation>
       </page>
      


      I want to display the @Out-jected accessRequestUser on user_access_request_step_2.xhtml (which is where we land after clicking the s:link)

      (from user_access_request_step_2.xhtml)
      #{accessRequestUser.name}
      ... more markup ....
      <h:outputText value="#{accessRequestUser}"/>
      etc...
      


      I can see from the log file that the SFSB method is being called, and that the accessRequestUser is being populated by my code, however, the user_access_request_step_2.xhtml page is not able to 'find' the accessRequestUser in any scope (display of attributes or the entire instance is blank). I must be missing something, I've looked this over and over and I can't figure out why @Out isn't working ... help?

      Thanks,
      Brad Smith


        • 1. Re: @Out problem (Seam 1.2.1)

          Never mind.

          Apparently, it's the redirect in pages.xml

          <rule if-outcome="2">
           <redirect view-id="/user_access_request_step_2.xhtml"/>
           </rule>
          


          that's causing the problem. I changed to render and now the @Outjection is working.

           <rule if-outcome="2">
           <render view-id="/user_access_request_step_2.xhtml"/>
           </rule>