Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Applet Serialization

Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one help me in telling the ways to serialize an applet after creating & painting(drawing graph) the applet. The applet will be passed with parameters with which it has to draw a graph and need to send it as a response.
I am trying to pass some parameter from an HTML which will call a servlet, which needs to send an applet that should be the bar graph of the parameters that i have sent.
(ie) i need to call a servlet xyz with parameter lets say a1=10,a2=20,a3=30..... like
I have the following methods in the applet
class xyzApplet extends Applet {
int parms[];
public void setParameter(int a[]){
parms = a;
public void DrawGraph() {
//take the values of parms[] and draw graph
I am doing the following piece of code in the doGet of servlet
int d[];
d[0] = req.getParameter("Graph1");
xyzApplet x= new xyzApplet();

How do I serialize the painted applet from the servlet. Can any one help me? If you could not understand the question please let me know.
Thanks a bunch
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It may be that you can do this, but it seems an odd way to work. Most people who use appellets configured by servelets use the following method:
1. A browser form or client program sends a GET or POST request to the servlet with the values as parameters. (you do this; good so far).
2. The servlet builds a HTML response page containing an <APPLET> tag with the parameters listed in <PARAM> elements, and returns it to the browser.
3. The browser fetches the applet and initialises it with the specified parameters.
So in your case of a specific graph display the servlet might recieve parameters a1=10, a2=20, a3=30 etc. and build an HTML reply containing something like the following:

This way, the applet doesn't need to be serialized, and can be cached in the browser and re-used for other graphs later if required.
Have I missed something? Is there some reason why you can't use this model?
Chandar S Vellithirumutha
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frank. You the man.....
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic