2 Replies Latest reply on Sep 18, 2014 4:21 AM by Jasper Oosterman

    Best practise for Session based configuration object

    Jasper Oosterman Newbie

      On the client I am developing a website where people can configure something in a couple of steps. Each step is a separate page as in the following:

       

      @Page(path = "step1")
      @Templated("CurationContentLayout.html#app-template")
      public class Step1Page extends CurationContentLayout 
      

      What I would like to do is have a sessionscoped object that I can fill in each step and can be used by subsequent (and previous) steps. At first I though that injecting the configuration in each step would do the trick but then all filled valued are removed since a new object is being inserted.

       

      @Inject
      CurationConfiguration config;
      

      My current solution is to store the configuration locally via the entitymanager and I have created a producer for the object that gets the configuration from the entitymanager such that it will be injected correctly.

       

      I was wondering if there is a better way to do this. Is it possible to have an sessionscoped (or singleton) object in the client that can be inserted and retains its values between page transitions (without manually persisting it)?

       

      Kind regards, Jasper