jsp to applet communication
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...
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());
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.
I've just solved my own problem. Bit of a silly mistake. My Customer object holds an array of Product objects. Although I implemented serializable for Customer I forgot to make Product serislizable. Everything works now.
By rickstrong in forum Java
Last Post: 04-02-2007, 05:58 PM
By Charlie Flynn in forum Java
Last Post: 08-23-2001, 11:01 AM
By Jo Desmet in forum authorevents.pekowsky
Last Post: 08-14-2000, 08:58 PM
Last Post: 08-10-2000, 12:35 PM
Last Post: 08-10-2000, 12:33 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL