Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

Applet -- Getting a list of parameters?

Thread view: 
Hal Vaughan - 11 Aug 2006 04:11 GMT
I'm working on a small JApplet class that is a wrapper class.  It will call
the main class, which can also be run on a system as an application.  I'll
be using this JApplet class in different contexts, so I'd like it to get a
list of the parameters passed to it from the web page.  All I can find is
the getParemeter() method.  I can't find anything that will let me get a
list of all the parameters.  Is there a way to do that?

I figured I could get a list of parameter names and use that to get each
parameter value, then pass them on to the primary class file as a String[]
object.  That way the primary class for this and future applets can all be
called from a main() function in the application class and from a JApplet
class as well.

Thanks!

Hal
Hal Vaughan - 12 Aug 2006 04:06 GMT
So should I take it that there is no way to get a list of all the parameters
passed to an Applet from an HTML page?

Hal

> I'm working on a small JApplet class that is a wrapper class.  It will
> call
[quoted text clipped - 13 lines]
>
> Hal
Matt Humphrey - 12 Aug 2006 14:02 GMT
> So should I take it that there is no way to get a list of all the
> parameters
> passed to an Applet from an HTML page?

Sadly, that's the truth.  If you notice the getParameterInfo method of
applets, they're supposed to publish what their parameters are, not accept
arbitrary lists of parameters.  You can circumvent this by using numbered
parameters (param-1, param-2, param-3) and looping through the numbers, but
the end result is still the same--the invoking page must really know what
the parameters are in advance.

http://java.sun.com/developer/JDCTechTips/2001/tt0821.html

Cheers,
Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/
Hal Vaughan - 12 Aug 2006 21:40 GMT
>> So should I take it that there is no way to get a list of all the
>> parameters
[quoted text clipped - 11 lines]
> Cheers,
> Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/

That's about what I had figured.  I understand the idea that one should know
the parameters for what is being called and an applet should specify the
needed parameters.  In this case, the applet class itself is a wrapper for
other applets, so I'd like to make that class as generic as possible.

I'm not trying to knock Java, but this is the kind of thing I often find
frustrating in Java: Do it our way or not at all.  Some languages go out of
their way to let you find ways to do what you want and it seems that Java
is more concerned with drawing lines and saying, "You can't go outside
here."  There's a lot of things I like about Java, but finding roadblocks
like this is not one of them.

Thanks for the info.

Hal
Andrew Thompson - 12 Aug 2006 15:51 GMT
> I'm working on a small JApplet class that is a wrapper class.  It will call
> the main class, which can also be run on a system as an application.  I'll
> be using this JApplet class in different contexts, so I'd like it to get a
> list of the parameters passed to it from the web page.  All I can find is
> the getParemeter() method.  I can't find anything that will let me get a
> list of all the parameters.  Is there a way to do that?

Parse the HTML itself (is one way*) E.G.
<http://groups.google.com/group/comp.lang.java.help/msg/f1108c5e5b7c883f>

( * the one way I am 'prepared to share', in any case.. ;)

Andrew T.
Hal Vaughan - 12 Aug 2006 21:43 GMT
>> I'm working on a small JApplet class that is a wrapper class.  It will
>> call
[quoted text clipped - 11 lines]
>
> Andrew T.

Okay, that's one way and I hadn't thought of it.  I had already come up with
the other idea mentioned here.  It looks like if I want a generic wrapper
applet class, I'm going have to do something like that.

Thanks!

Hal


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.