3 Replies Latest reply on Feb 12, 2007 6:48 AM by pmuir

    refresh view

    straubp

      Hi,

      I'm having an entity like person with a sub entity like an address. On a page I'm showing information about the person:

      <h:outputText value="#{person.id}" />
      <h:outputText value="#{person.address.street}" />
      

      Now I'm pressing a next-button to show the infos about the next person:
      public void next() {
      
       person= (Person) database.merge(personListManager.nextPerson());
      }
      

      The next person then gets loaded and outjected. What now happens is that #{person.id} is showing the id of the next person but #{person.address.street} is still showing the data of the first one. Seems like the sub-entity got cached and is not refreshed.

      Can somebody please tell me, how I can display the right address?

      Thanks!

        • 1. Re: refresh view
          pmuir

          You'll need to post the code for person and for address

          • 2. Re: refresh view
            straubp

            Hi petemuir,

            thanks for your quick reply!

            But I just figured it out:
            I use the RedirectFilter but haven't defined a redirect in pages.xml for the page when the outcome is null (I thought this wouldn't be necessary). Now I have:

            <navigation from-action="#{personListManager.nextPerson()}">
             <redirect view-id="/person.xhtml" />
            </navigation>
            

            With this it's working now. By the way, is there a rule to redirect to the current page when the outcome is null or unknown?



            • 3. Re: refresh view
              pmuir

              If the outcome is null, the current page is redisplayed (rather than redirected to) - so whats happening is that on your redirect (as you said above) more things are getting refreshed than on the redisplay. Without seeing what scopes you are using its hard to say more ;)