views:

37

answers:

1

There's getParameter() which is fine for reading a parameter I know of.

However, should I want (for lib architecture reasons) to read all the parameters that have been passed to an applet, is there a way to do it?

I've looked at the API and googled a bit, but no luck.

+1  A: 

AFAIK you can't read in unknown parameters using the standard applet API.

Which doesn't make sense anyway. What are you going to do with unknown parameters? Care to explain why that might be useful.

A way to do it nonetheless, if you really want, is to use JavaScript and call a method defined in your applet and just pass it in the parameters.

How that works can be read up on several places. Here a few starting points:

JavaScript to Java Communication (Scripting)

Liveconnect: Calling from JavaScript to Java

Mozilla DevCenter: JavaScript to Java Communication


Regarding authors comment:

If I understood you correctly you could also enforce that every applet your lib constructs overwrites the Applet.getParameterInfo() method and returns appropriate information.

Now you could provide a static map for the parameters which the applet declared to be supported.

jitter
Your point of view is valid. The reason for this is that I'm working on a lib that supports complex applet creation, although each individual application that may be built can have different requirements. If I could load indiscriminate parameters, I'd make them accessible to the rest of the application in a static map. This way, I'll probably just keep a reference to the applet object and make getParameter available by delegation.
Francisco Passos
Expanded answer. Check second part
jitter
Your first approach revealed something was wrong in the way I was looking at the problem. We're keeping a reference to the applet object, which for that matters works much the way that a map would if we knew what to load into it in the first place.
Francisco Passos