1 Reply Latest reply on Mar 16, 2009 11:55 AM by Stuart Douglas

    Conversation Understanding Problem

    Ralf H. Newbie


      i am looking for a best practise example for ending a conversation.
      Lets say i have an ActionBean

      public class MyBean implements MyBeanLocal{
        private EntityManager em;
        private Something something;
        public void beginSomething( ){ ... }
        public void doManyThings( ){ ... }
        public void doMoreThings( ){ ... }
        public void doManyMoreThings( ){ ... }
        public void endSomething( ){
          em.persist( something );

        <h:commandbutton action="#{myBean.endSomething} value="Save" />

      Normally i persist my Object 'something' in the method 'endsomething', which ends the conversation.

      So i have 2 questions:

      1. But what happens, if the application raises an exception OR a form validation error occures? The Conversation would be ended and i have no chance to get back.

      2. How may/sould i handle pushing the 'back' button in the browser after succeeding the action?

      Thanks for your answer,


        • 1. Re: Conversation Understanding Problem
          Stuart Douglas Master

          If conversion fails the action method will not be called, unless you have immediate=true on the submit button (which does not make sense anyway).

          In the app raises an exception you generally can't recover anyway, this depends on the circumstances. The main reason for this is some entityManger exceptions do not allow you to resuse the entityManager, so there is not easy way to recover gracefully.

          I can't really say about the back button, it depends on what makes sense for your app. If you know how you want it to work we can probably help, but what makes sense for one app does not make sense for others.