Session with Applet to Servlet


Web tier: servlets, JSP, Web frameworks: Session with Applet to Servlet

  1. Session with Applet to Servlet (1 messages)

    How to maintain session when there is applet to servlet communication.
  2. Session with Applet to Servlet[ Go to top ]

    on the servlet, you just have to use req.createSession(true) to get a session for the current connection.

    when you send a response to the applet, the servlet will send an http header named set-cookie. Get this value and keep it in a private string cookie for example.

    this is if you don't send other cookies from the servlet to the applet ...

    after that, if you want to connect the applet using the same session, write a header using URLConnection.setContent("Cookie", cookie).

    if you call createSession(false) on the servlet, it will read this and restore the session that was created for the user.

    hope it helps