Announcement Announcement Module
No announcement yet.
Multiple tabs Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple tabs

    I think this is something that has happened before, so I hope that someone has a solution for this problem.

    In our application it's possible to open a list of users. From those users it's possible to open a profile view (with a form). It must be possible to open several tabs at the same time, in several different tabs. The problem is that if you open several tabs and you edit the first one, that data is saved on the last opened subject.

    Is it possible to get around this? I was thinking of generating a unique ID (with UUID and adding an attribute to the form containing that ID. The session holds a map of user objects, with that id as identifier.

    The problem is, what about binding the attributes? I mean, instead of binding it to an object, you have to bind it to an object in a map, corresponding to a specific key.

    My guess is that instead of doing this:

    ModelAndView view.add("user", user);
    <s:bind path="user.username">...</s:bind>
    you have to do this:

        view.add("userMap", userMap);
        view.add("key", key);
       <s:bind path="userMap[key].username">...</s:bind>
    Am I correct on this one? I haven't tested this solution yet, I'm just brainstorming :-). If there are better solutions, feel free to post them.

  • #2
    Found a better solution.

    However, there is still a problem:
    You can pass a specific session id as the hidden variable and retrieve it by httpServletRequest and add it with the session attribute name while showing and submitting the form. That will help you to enable to work with multiple session and multi window.
    Our flow is like this:

    page contains link => Regular Controller adds user object to ModelAndView, show page containing the form => Submit form => FormController.

    As you can see, the controller which redirects to the page containing the form just implements the Controller-interface, which holds only 1 method, namely handleRequest.

    To be able to retrieve the form object from the session, we must put it there with a generated ID. I don't see how to do this.


    • #3
      Why not use webflow? Each tab has it's own flow execution and thus own data.... You get all the stuff you are trying to do out of the box...


      • #4
        Because we don't use Webflow since our application is not complicated enough to use it. It's too late to change that decision, so I have to find a solution for Spring MVC.