Maybe I don't need to use cookies for this (or maybe I do).
On a series of web pages, I have a handful of applets. All these applets share the same code base.
The problem is a basic one. I need to get information from one applet to another.
Let's say I have a LOGIN applet that gets the username from the user (on the index.html page). That applet has an OK button that will load the doWork.html page that has an applet on it called WORK. I want to get the username from the LOGIN applet to the WORK applet.
After reading this:
http://www.javaworld.com/javatips/jw-javatip101_p.html It seems to me that all I need to do is to have a reference to the LOGIN applet from within the WORK applet and simply invoke the loginApplet.getUserName() method to retrieve the data.
This seems too simple...am I missing soething here?
Here are some code fragments of what I'm planning to implement:
step 1. set up the reference to the LOGIN applet in the LOGIN applet.
Step 2. in the WORK applet, get the LOGIN applet reference.'
Step 3. From within the WORK applet, get the user name data
Is this a sound approach? What if the user tries to access the WORK page before going through the LOGIN (index.html) page first? What happens when the user hits the refresh button or the back button on his browser? What happens if the user is using a tabbed browser and logs in simultaneously as different users on differet tabs (from the same browser)?