3 Replies Latest reply on Jul 2, 2007 1:04 PM by Grant Rettke

    Page action pain, new stateless component instance?

    Grant Rettke Novice

      Hi guys,

      Question for you. I've got a RESTFul page whose sole purpose is to prepare another page. It has an action that only gets run once. As such, it is set up to immediately redirect to another page (since I don't want that action run every single time). Here is how it looks

      <page view-id="/prepareInspectionRequest.xhtml"
       action="#{inspectionRequestAction.preparePage}">
       <param name="accountNumber"
       value="#{inspectionRequestAction.accountNumber}"/>
       <param name="userProfile"
       value="#{inspectionRequestAction.userProfile}"/>
      
       <navigation from-action="#{inspectionRequestAction.preparePage}">
       <rule if="#{inspectionRequestAction.validRequest}">
       <redirect view-id="/inspectionRequest.xhtml"/>
       </rule>
       <rule if="#{not inspectionRequestAction.validRequest}">
       <redirect view-id="/message.xhtml"/>
       </rule>
       </navigation>
       </page>
      


      As written, when I step through inspectionRequestAction with the debugger, I evalute "this.hashCode()" within the setter for accountNumber and it evaluates to 29656067. When I step into preparePage and evalute hashCode I get 11498117. This is confusing to me because this is a stateless bean. The result of my setup is that my fields don't get populated correctly.

      What am I doing wrong here?

        • 1. Re: Page action pain, new stateless component instance?
          Grant Rettke Novice

          To clarify, when I set up the flow in this manner, the two properties get lost. I suppose that the hashCode doesn't matter, I just want my stateless component.

          As an aside, when I set this up using two stateless components a "form" and then the "action", everything works correctly.

          Here is a log from this flow:

          2007-07-02 11:49:24,707 DEBUG [com.churchmutual.rms.action.impl.InspectionReques tActionImpl] Set account number: 0000415-02-1024
          2007-07-02 11:49:25,629 DEBUG [com.churchmutual.rms.action.impl.InspectionReques tActionImpl] Hashcode: 32053749
          2007-07-02 11:49:35,207 DEBUG [com.churchmutual.rms.action.impl.InspectionReques tActionImpl] Set user profile: JohnDoe
          2007-07-02 11:49:35,707 DEBUG [com.churchmutual.rms.action.impl.InspectionReques tActionImpl] Hashcode: 5658787
          2007-07-02 11:50:13,831 DEBUG [com.churchmutual.rms.action.impl.InspectionReque tActionImpl] Prepare page
          2007-07-02 11:50:13,831 DEBUG [com.churchmutual.rms.action.impl.InspectionReque tActionImpl] Hashcode: 21178698
          



          • 2. Re: Page action pain, new stateless component instance?
            Pete Muir Master

            A stateless bean has no guarantee of holding state between method requests. Try putting it in the EVENT scope.

            • 3. Re: Page action pain, new stateless component instance?
              Grant Rettke Novice

               

              "pete.muir@jboss.org" wrote:
              A stateless bean has no guarantee of holding state between method requests. Try putting it in the EVENT scope.


              Hi Pete, I'm really having a day over here. I can't believe I even posted this. I thought that it had been cut over to a stateful component already. I even posted about it being stateless. Thanks for listening I hope you don't charge standard therapist fees on this stuff.