Discussions

Web tier: servlets, JSP, Web frameworks: URL encoding when forwarding

  1. URL encoding when forwarding (2 messages)

    I am trying to do a forward whilst encoding the session id in the URL (so Im not reliant upon cookies). I have tried both the following:

    context.getRequestDispatcher(response.encodeURL(responseURL)).forward(request, response);

    context.getRequestDispatcher(response.encodeRedirectURL(responseURL)).forward(request, response);

    Neither seems to work, data put in the session is not carried over to subsaquent JSP. The only examples I can find are for a sendRedirect, not a forward.

    Thanks for any help
    Andrew.

    Threaded Messages (2)

  2. URL encoding when forwarding[ Go to top ]

    you might want to try a doPost instead of doGet.
  3. URL encoding when forwarding[ Go to top ]

    The problem is that the request object is probably overwriting the query string in the URL. Try this instead,

    request.setQueryString(URLEncoder.encode("All the parameters");
    OR
    request.setAttribute("sessioId", sessionId);


    context.getRequestDispatcher("Actual redirect URL").forward(request, response);

    -j