This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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 ]
Joined: Jun 18, 2008
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?
Joined: Aug 10, 2005
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;