4 Replies Latest reply on Mar 5, 2008 3:19 PM by jeremy girard

    Add using home object

    jeremy girard Newbie

      Hi,


      I'm using seam 2.0.0.GA and jboss 4.2.2.GA.
      I use home object to perform simple CRUD operation.


      My problem is that when i process the save operation and go back to the same page, all form field are filled in with previouly insert data.


      I want my field to be empty. How can i do ?


      Thanks.

        • 1. Re: Add using home object
          Damian Harvey Apprentice

          It depends if you are navigating away from the page or not. Either way have a look at clearInstance() in your persist() or update() method.


          Cheers,


          Damian.

          • 2. Re: Add using home object
            jeremy girard Newbie

            Thanks for your answer.


            I've done severial things : cleanInstance() in my persist homeobject method


            String result = super.persist();
                      clearInstance();          
                      return result;



            Tried to remove the bean from context



                      
                      if(pageContext != null)pageContext.remove("accountItem");
                      if(eventContext != null)eventContext.remove("accountItem");
                      if(serverConversationContext != null)serverConversationContext.remove("accountItem");
                      if(basicContext != null)basicContext.remove("accountItem");



            But the field are still filled in with the submitted and persited accountItem

            • 3. Re: Add using home object
              Damian Harvey Apprentice

              Post your code so we can have a looky.


              Also there is the Contexts.removeFromAllContexts() method that you can use instead of going through them all (does the same thing though).


              Cheers,


              Damian.

              • 4. Re: Add using home object
                jeremy girard Newbie

                That's it.
                I was on the right way when trying to remove something on context but i don't know where to remove.


                With Contexts.removeFromAllContexts(), it works.


                Thanks a lot Damian.