3 Replies Latest reply on Jul 7, 2009 10:06 PM by juanvinuales

    scope of a user when registering

    juanvinuales

      Hello,


      I'm developing a quite simple seam application that lead me to a quite simple question.
      I have a 'user' entity named 'usuario', scoped to SESSION:



      @Entity
      @Scope(SESSION)
      @Name("usuario")
      public class Usuario ...{
       private String name;
       private String email;
       ...
      }





      However, when registering a new user, i use a conversation, managed by the ejb 'registroAction':



      @Name("registroAction")
      public class RegistroAction ... {
       @In
       @Out
       private Usuario usuario;
       ...
      }





      Then, as you can see, when the registering begins, a user is injected in the 'registroAction' component to manage the whole process.
      The problem is the following:

      - as 'usuario' has a session scope, leaving the registration page and re-entering, causes the form to repopulate with the values yo eventually entered before:


      <h:inputText id="email" value="#{usuario.email}" ...>




      - if a user if logged in, and enters the registration page, the whole form is populated with the actual user values (I've not try this yet, but i guess that is what will happen)


      what's the correct approach to solve this?


      thanks in advance,
      Juan