Jumping between apps with Struts


EJB programming & troubleshooting: Jumping between apps with Struts

  1. Jumping between apps with Struts (4 messages)


    I have several Struts-based webapps, and i want to let the user 'jump' between these apps. I want to know if it's possible to detect when the user is going to jump between apps, to copy some data stored in session, and retrieve the same data in the second app, so i can re-store it in session.

  2. i would use a cache manager i.e . oscache / Tangosol Coherence Cache. or something else and write the users details to the cache using the username and then when the use moves between apps load the data back into the session
  3. We are going to use a cache manager, but we don't know if whe should store all data in cache, or in session and only load from cache when the user moves to a new app, or what... Besides, we don't know the performance of these cache managers in a cluster environment, so we don't want to use the cache manager more than necesary.
  4. Jumping between apps with Struts[ Go to top ]

    The best (standard-based) trick I have found for transferring session data in web apps is to retrieve a RequestDispatcher to a servlet in the other application, and forward the session data stored in as request attributes. Here is some pseudo-code:

    // In webapp 1
    public class SendSessionDataServlet ... {
      public doGet(request, response) ... {
        // Get dispatcher to servlet in app2:
        ServletContext app1context = this.getServletConfig().getServletContext();
        ServletContext app2context = app1Context.getContext("app-2-contextpath");
        RequestDispatcher dispatcher =

        // Copy session data to request and forward
        Object value = request.getSession().getAttribute("session-value");
        request.setAttribute("session-value", session-value);
        dispatcher.forward(request, response);

    // In webapp 2
    public class ReceiveSessionDataServlet ... {
      public doGet(request, response) ... {
        // Retrieve session data from request
        Object value = request.getAttribute("session-value");
        request.getSession().setAttribute("session-value", session-value);

    However, this is a cludge. A good cache manager would be a much better solution. I would only use the above trick for passing user-specific data, like security credentials to support a single-sign-on.
  5. Is it possible to include one application into another???

    And manage the include application independent of the another?