Link to home
Start Free TrialLog in
Avatar of mco
mco

asked on

Listing all applet parameters?

How can I get a list of all the parameters listed for an
applet in the HTML code?
Avatar of heyhey_
heyhey_

i don't think you can get a list of all the parameters (except the broute force -
'test all strings'), but why do you need this kind of functionality ???

aplets are pieces of code that work with FIXED number of parameters and you can change
this parameters with simple HTML code, why do you need variable parameters to be passed

  there was some interesting article (i think JavaWorld) how to implement
  applet skeleton that finds out all his own fields (using reflection) and fills
  them with parameters from the APPLET tag

for example:
class MyApplet {
 
      public int param_counter;
      public String param_name;
      public String param_data;

      public void paramInit ()
      {
            ..
            ... // code
            ..
      }
  }

  and param init will check for all public fields, whose names begin with
  param_ an load them from appropriate parameters (if exist)
  (paramInit will check for parameters named "counter", "name" and "data" anf loads
  their values in the appropriate parameter (with appropriate  type)

  is this what you want to do ?
   heyhey

Avatar of mco

ASKER

The JavaWorld suggestion does not answer my needs.

The applet I am working on is quite big and the code is written by quite a few people.
It is actually just a Web implementation of an application.
We use many environment variables, which are implemented as system properties.
Their values are taken from the applet parameters.
It is true that we know the list, but since this project is quite big, in practice, any time someone
wants to add a new prameter (to be converted to a system propoerty) he has to notify
the person doing the conversions about it, and the latter has to modify his code.
It would have been much more convenient to be able and create all the required system properties, without knowing the full list in advance.

When using the program as an application there is no such problem.

again, i don't think you can get a list of all the parameters, but i don't see how you can use this abstract list of parametere names + values (if you need such a list - then pass it as one parameter - not as a set of parameters)

when adding new parameters you have to add new logic - you don't need just abstract "give me all parameter names" information, ok ?
so changing the parameter list means changing the code, ok ? and somebody have to change the code "source time" - he can't add the new parameters information logic at run time...

so you have to change
- parameter list
- .java sources to handle the new parameters (its the parameter logic :)

JavaSofts article helps you to modify only the .java sources and InitParam will handle (load) parameters from the APPLET tag.

So - if you really need just a list of <paramName - paramValue> - then pass it as one APPLET tag parameter - not as a set of parameters

hope this helps ?
  heyhey
Avatar of mco

ASKER

This might be a good solution.
BTW, will this syntax work?

<PARAM name=details value=AAA=xxx BBB=YYY>

or will this work

<PARAM name=details value="AAA=xxx BBB=YYY">

Avatar of mco

ASKER

This might be a good solution.
BTW, will this syntax work?

<PARAM name=details value=AAA=xxx BBB=YYY>

or will this work

<PARAM name=details value="AAA=xxx BBB=YYY">

ASKER CERTIFIED SOLUTION
Avatar of heyhey_
heyhey_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial