File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes How to Pass ArrayList to Applet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to Pass ArrayList to Applet?" Watch "How to Pass ArrayList to Applet?" New topic

How to Pass ArrayList to Applet?

Minn Myat Soe

Joined: Dec 03, 2004
Posts: 3
Is there a way to pass Collections to Java Applet from a JSP or a servlet?

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63867

"Minn Minn",

We're pleased to have you here with us in the JSP forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Forum Bartender

[Asking smart questions] [About Bear] [Books by Bear]
Minn Myat Soe

Joined: Dec 03, 2004
Posts: 3
I'm sorry that I don't have any Christian name. I am known by most people as "Minn Minn". Anyway, I've changed it according to my passport name.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

You *can* pass a collection into an applet from a JSP page... but you have to remember that the applet is running in the client's JVM inside their browser, while the JSP is running in the JVM on your server. So you can't pass the collection directly. If the collection is a collection of Strings (or a type easily represented by strings), you could just have code that builds the applet tag dynamically and inserts a param tag for every element in the collection. Then have the applet parse the param strings to build the collection again from the strings. If your collection is some other type, you'll need to look into some kind of distributed technology like RMI, and make the applet a RMI client. Then you can run a RMI server on your web server and pass the applet values through RMI.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: How to Pass ArrayList to Applet?
It's not a secret anymore!