|
-
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...
<%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.
Similar Threads
-
By rickstrong in forum Java
Replies: 2
Last Post: 04-02-2007, 05:58 PM
-
By Charlie Flynn in forum Java
Replies: 3
Last Post: 08-23-2001, 11:01 AM
-
By Jo Desmet in forum authorevents.pekowsky
Replies: 1
Last Post: 08-14-2000, 08:58 PM
-
Replies: 1
Last Post: 08-10-2000, 12:35 PM
-
Replies: 1
Last Post: 08-10-2000, 12:33 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
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
|
Bookmarks