Servlet ---> (Object) ---> Applet

A

Andrew Tucker

Hi everyone,

I have a situation where i would like to pass a Vector object to an applet
(to populate a JComboBox) via a servlet. Can this be done? I am about to
start mucking around w/ HttpServletResponse.getOutputStream() and try and
pass the data through to the applet as strings to construct the vector at
the other side and THEN populate the combo box. I am worried about latency
when the method popupMenuWillBecomeVisible is called and when the box is
actually populated. If anyone has an alternative idea i would love to hear
it!!

cheers, Andrew.
 
M

Michal Dzirba

Hi everyone,

Hi,
I have a situation where i would like to pass a Vector object to an applet
(to populate a JComboBox) via a servlet. Can this be done?
Yes,

I am about to
start mucking around w/ HttpServletResponse.getOutputStream() and try and
pass the data through to the applet as strings

or wrap it in a ObjectOutputStream and send the whole Vector ( which
should be a ArrayList since java2 [unless you are in for msjvm
compatibility;])

Michal.
 
P

pete kirkham

Michal said:
Hi everyone,

Hi,

I have a situation where i would like to pass a Vector object to an
applet
(to populate a JComboBox) via a servlet. Can this be done?

Yes,

I am about to
start mucking around w/ HttpServletResponse.getOutputStream() and try and
pass the data through to the applet as strings


or wrap it in a ObjectOutputStream and send the whole Vector ( which
should be a ArrayList since java2 [unless you are in for msjvm
compatibility;])

Michal.

ObjectOutputStream will break if your servlet and applet aren't on the
same version of the JVM. (this may or may not be a problem for you)

Another way is to use the new XML bean encoding on the servlet, and use
reflection on the applet to rebuild the object (as you can't guarenree
it'll have the new library).

Or just use a simple custom string format which is easy to parse. I'd
probably try to use something close enough to the <option> element in
HTML to allow you to view the output of the servlet in a browser to
debug it.


Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,268
Latest member
AshliMacin

Latest Threads

Top