3 Replies Latest reply on Feb 15, 2008 9:02 AM by mars1412

    Help - post login and EntityHome instance

    Terry Apprentice

      I am not sure if my problem is conversation related, or something I'm missing.

      I have two menu links on the page. Login and Add User. Login is via Seam authentication with users in my database. Login link uses UserHome object to update user login history; and AddUser.xhtml is bound to UserHome as well.

      When I click on Login link and perform login, the page refreshes the Edit User link generted by s:link is already appended with the UserId causing it to load record of the logged in user; instead of giving blank Add User form.

      I this it is because UserHome has already been initialised by my login process. But I am not sure, what should be done after the login process to avoid this?

      Login Link
      <s:link view="/login.xhtml" value="Login" rendered="#{not identity.loggedIn}" propagation="none"/>
      
      Add User
      <s:link view="/user-edit.xhtml" value="User Add" propagation="none"/>
      
      login.page.xml
      <page conversation-required="false">
       <navigation>
       ...
       </navigatioin>
      </page>
      
      user.page.xml
      <page no-conversation-view-id="/user-list.xhtml" login-required="true">
      
       <begin-conversation join="true"/>
       <action execute="#{userHome.wire}"/>
      
       <param name="userFrom"/>
       <param name="userId" value="#{userHome.userId}"/>
      
       <navigation from-action="#{userHome.persist}">
       <end-conversation/>
       <redirect view-id="/user.xhtml"/>
       </navigation>
      
       <navigation from-action="#{userHome.update}">
       <end-conversation/>
       <redirect view-id="/user.xhtml"/>
       </navigation>
      
       <navigation from-action="#{userHome.remove}">
       <end-conversation/>
       <redirect view-id="/user-list.xhtml"/>
       </navigation>
      </page>
      


        • 1. Re: Help - post login and EntityHome instance
          Pete Muir Master

          Easiest solution is not to use userHome as part of your login process.

          • 2. Re: Help - post login and EntityHome instance
            Terry Apprentice

            thanks, I should do that for login process.

            However, I discovered I have similar problem with other forms. If I view View or Edit form, both of wich utilise EntityHome, and then right after I click on Add form, the Add form shows record which was focused by View or Edit form.

            Is there a way, to empty out the EntityHome before loading a JSF form, eg Add form?

            • 3. Re: Help - post login and EntityHome instance
              mars1412 Apprentice

               

              "terryb" wrote:

              If I view View or Edit form, both of wich utilise EntityHome, and then right after I click on Add form, the Add form shows record which was focused by View or Edit form.


              Did you solve that?
              I have the same problem and I am quite stuck.
              I have no idea why this entity is not cleared...

              I have a parent/child connection:
              the parent's edit page shows a list of the childs
              when I first access the parent's edit page, a conversation is started, including the parentHome
              the list of childs has a select s:button with propagation=end and it passes the childs id to the child edit page
              this should be ok - I want to end the parents edit conversation and the childs pages.xml starts a new conversation for the child
               <begin-conversation join="true" />
              
               <action execute="#{childHome.wire}"/>
              
               <param name="childId" value="#{childHome.childId}"/>
               <param name="parentId" value="#{parentHome.parentId}"/>
               ...
              

              I don't understand this:
              • I open the parentList - no conversation exists
              • I open a parentEdit page - one conversation exists: cid=3
              • I click on a child in the list and come to the childEdit page
              • now one conversation exists, but it still has the cid=3

                should not the cid 3 have ended (the s:button says so) and a new conversation begun (the childEdits page.xml file says so?

                I suspected that join=true on the start-conversation might be the reason: but even without join=true, the cid is the same.

                please help