Hi can anybody help me with this jsp/servlet/applet communication problem.
I have a variable of type Customer in a jsp page and I want to send the Customer object to an applet on the same page.
I have been told the only way to do this is via a servlet.
So in the jsp page I put the Customer object named myCustomer in the session...

<%session.putValue("c", myCustomer);%>

and I am now able to get the customer object in the doGet method of the servlet...

Session s = req.getSession();
Customer jspCustomer = (Customer) s.getAttribute("c");

OK, everything works so far. I can use all the public methods of Customer within my servlet.

My problems start when I try to send my Customer object to the applet over a http connection (I have imported all the relevent libraries into the servlet)

ObjectOutputStream toApplet = new ObjectOutputStream(res.getOutputStream());
toApplet.writeObject(jspCustomer);

When I load my jsp page the applet doesn't work.

The interesting thing about this problem is that if I make a Customer instance within the servlet and send this instance to the applet it works fine.
Surely my jspCustomer should behave exactly like a Customer instantiated within the servlet? If I can send one object to the applet then I should be able to send either.

Any help on this is much appreciated. Or if you think I am going in the completely wrong direction I'm interested in alternative approaches.