1. on the server side you do something like in the JSP that produces the frame for the applet: <applet name="SomeApplet" 
codebase="http://your.server/path" 
code="Some.class" 
width="97%" 
height="97%"> 
<param name="sessionId" 
value="<%= request.getSession().getID() %>"> ... 
</applet> 2. then your applet accesses the parameter "sessionId" and has it. 3 additionally: you can always implement your own session management - this option is feasible in every case. you would transfer your own session ids with the requests and during instantiation of the applet. does this help you? 

解决方案 »

  1.   

    another methord is that using the cookie;(first you need to pass the session id into the applet, I'll leave that up to you, whether with javascript or parameters...you may want to encrypt them and decrypt within the applet for security...up to you)...when connecting back to the servlet, use the URLConnection.setRequestProperty( x1, x2); 
    where x1 == "Cookie" (actually the word Cookie), and x2 is a name value pair....now, the name is the name assigned to session identification by your web application container, in WebSphere it's "sesessionid" (consult your container docs on that one - you can configure it in most containers) and the value is your HttpSession.getId() value...so, you might have 
    URLConnection.setRequestProperty 
    ("Cookie", "sesessionid=4553cx987e2") or something similar...then just continue as normal and you should be able to access that session as if it were coming from a browser...of course, this only works for cookie implementation. 
      

  2.   

    问题是我已经在Applet中得到SessionID,但是在Applet中,怎么控制与该SessionId对应的Session呢?
      

  3.   

    去看一下ObjectInputStream与ObjectOutputStream,把你的session通过Serialize后变成流传递到Applet来重建一下,通信的问题自已要处理。