Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pas a Java Object into an Applet

 
Dar Var
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jsp page where I invoke a JavaBean. The jsp page also contains an applet

Can I pass the bean object into one of the applets method or its constructor.




 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that the JSP and the Applet run on different machines and at different times. The Java code in the JSP runs on the server, before the user sees the page. The Java code in the applet runs on the desktop, after the JSP code is completely through running.

You have two general options.

First, you can encode the JavaBean's data into the page, as applet parameters, and let the Applet rebuild the JavaBean itself.

Second, you could arrange to have the JavaBean live longer than the JSP -- perhaps by storing it in the user session -- and then let the applet download it as a serialized object. To do this second option, you'd need another JSP, or preferably a servlet, that the Applet could contact to download the object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic