Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Array of Objects Paramater to Applet

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am trying to send an array of objects( objects of type "Activity" which is a user -defined class) as a parameter to Applet But am not sure how to do it? can someone help?

Thanks
 
Master Rancher
Posts: 4888
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you calling the applet?
If by using the <APPLET tag then you pass values to it using <PARAM tags. Since <PARAM tags are created at HTML creation time, I don't see how this could be use to pass an array of objects.
If by calling if from another applet you'd use the getApplet/getApplets method of the AppletContext to get a reference to the applet that you could call with the array.

Where is the array of objects being created? If on a server before creating the HTML, you'll have to do your own "serialization" of the data into valid HTML characters before creating the <PARAM tags with that data.
[ June 25, 2008: Message edited by: Norm Radder ]
 
Nitin Sharma
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am embeding the applet in a jsp and am passing parameters using the Param tag. I get the arrayof ojects from a session varaible.

What i am trying to do actually is
1) Try gettin an array of objects from the session and set it to an array

2) pass the array as a parameter

<param name="blahblah" value="<%=arayname%>">

When i retrieve i just hae a method called this.getParameter() that returns just a string..

I dont know how to retireve the array from the getParameter method?

Thanks
 
Norm Radder
Master Rancher
Posts: 4888
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To pass a number of parameters similating an array you need to generate names by appending a suffix, such as 1, 2, 3, ... to the value that is used in the name= attribute of the <PARAM tag. EG
<param name=elem1 value=...>
<param name=elem2 value=...>
<param name=elem3 value=...>

Then in the applet, have a loop the builds the name by appending a digit, gets it, checks for null, processes it and continues. Something like the following;
 
Catch Ernie! Catch the egg! And catch this tiny ad too:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic