0 Replies Latest reply on Oct 22, 2007 12:08 PM by Jaime Martin

    seam gened app and sessions behaviour

    Jaime Martin Apprentice

      I´ve created an app by means of seam-gen without EJB3.
      I haven´t added anything to the java or the view (xhtml and .page.xml) files up to now.
      Let´s call the table Info, the following steps work fine:
      - creating new data (InfoEdit.xhtml and InfoEdit.page)
      - details of a new Info displayed in the Info.xhtml
      - list of records in InfoList.xhtml.

      But there are some things I don´t like of the initial behaviour:
      - after creating a new Info, if just after that you want to create a new one, the
      InfoEdit.xhtml shows in the fields the info of the one that just have been created.I must log out and log in again and then the InfoEdit.xhtml displays no previous data)
      - If I go to the list, and select one row to display its data (view.gif that goes to Info.xhtml). After having a look to that previously created Info, you go to create a new one, again the InfoEdit.xhtml displays the info, this time of the one I´ve just seen.

      What happens is logic, because all this pages work with the same InfoHome object, and the info of the instance hasn´t been cleaned. What should be the best way to avoid logging out each time to clean the session?
      One way I´ve tried, and that works is creating a new method in the home which would be invoked when pressing the save button. This method executes the persist() and then clean the instance (setInstance(this.createInstance()). This solves the problem when creating a new one, after having created an Info. But this is useless if you go to the InfoEdit after Info.xhtml from a List.
      I´ve tried something with the Contexts.removeFromAllContexts but with no success.
      What would be the best way to accomplish this? using different homes?

      By the way, I go to the InfoEdit.xhtml using menuItems this way:

      <rich:menuItem value="#{messages['New']}" action="/InfoEdit.xhtml"/>

      thanks in advance!