2 Replies Latest reply on Dec 8, 2008 11:16 PM by Adam Jordens

    Rendering page incorrectly after rending email

    Wayne Bagguley Newbie

      I'm in the stages of implementing registration using IdentityManager. I created the registration of a new user with no problems but when I came to adding a listener to send an email, the rendering of the response page went awry.


      @Observer(JpaIdentityStore.EVENT_USER_CREATED)
          public void sendNewRegEmail(User userIn) {
               Renderer renderer = Renderer.instance();
               log.info("RegistrationListener");
               log.info("User : #{userIn.id}");
               // Create new key
               ValidationCode code = new ValidationCode();
               code.setCode(ValidationCode.generate());
               code.setUser(userIn);
               userIn.setValidationCode(code);
               entityManager.persist(code);
               entityManager.persist(userIn);
      
               try {
                      renderer.render("/mail/register/simple.xhtml");
                      log.info("Email Sent");
                  } catch (Exception e) {
                      log.info("Email sending failed");
                  }
               
               log.info("End of RegistrationListener");
          }
      



      Instead of the next page being rendered as the response page (as before the email code was added), I get the current page but it's messed up, with bits in the wrong place and links with the wrong URLs.