I am using a JSP/Servlet application, in the middle-tier - and a client applet to communicate with these using the URLConnection class. The communication protocol is thus HTTP, so I have the usual issues of state management - I have the option of using either URL rewriting or cookies, or both options in my case.

Thus, the home page downloads initially, downloads the applet, downloads a cookie with the jsessionid, and of course will also have rewritten all the URLs in the page to include the jsesionid (as initially the server cannot determine if cookies are allowed by the browser). So to my questions:

1) How can I access the cookie from the browser from within the Java applet [so that I can transmit it back to the server when I open the URLConnection]?

I have come across something called Jsobject, but am unclear as to what it allows me do.

2) Do I need JavaScript within my page, plus enabled on the browser for this to work?

Thanks for your help