aspose file tools*
The moose likes Servlets and the fly likes Passing Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Passing Objects" Watch "Passing Objects" New topic

Passing Objects

Jeff Wisard
Ranch Hand

Joined: Jan 07, 2002
Posts: 89
I have an applet that needs to pass objects back and forth to a servlet. Can anyone show me an example of the servlet code for this? (The applet code would be helpful as well...)

Jeff Wisard<br />Sun Certified Java Programmer (Java 2)<br />Sun Certified Web Component Developer
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12769
There is an example in my Servlets and JSP book using some classes that Paul Weaton wrote. That com.javaranch library is somewhere on JavaRanch but I don't remember how to get to it.
If you will drop me a line, I can send you the code from that chapter.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

You can find the Javaranch Common Classes info here
Jeff Wisard
Ranch Hand

Joined: Jan 07, 2002
Posts: 89
Alright. Cool and thanks. Next Question: Essentially what I want to do is stream a large amount of data from the servlet to the applet. What I need to do is send this data in blocks. For example, I have an array of 1000 objects (all serializable) and I want to send them to the applet in blocks of 100....all within the same request. What are the issues here? Can I send more than one block (array of objects) via the ObjectOutputStream.writeObject() method without closing the output stream?
I also noted that the code you pointed me to is using GZIPInputStream. What are the advantages and disadvantages of this?
Thanks again.
It is sorta covered in the JavaRanch Style Guide.
subject: Passing Objects