Home arrow static arrow Java Programming [Archive] - Applet is caching
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Applet is caching
This topic has 5 replies on 1 page.

Posts:254
Registered: 4/15/04
Applet is caching  
Jul 2, 2004 6:41 AM



 
I have a JSP which loads an applet. This JSP contains some parameters which get set depending on who you are logged in as.

When the applet loads, it reads in these parameters and displays certain things dependant upon those parameters.

When I log in a userA, the applet loads correctly. When I log out and log back in as userB, it still uses the information from userA. The JSP has changed, and shows different parameter values( the parameters for userB). So it is definitely the applet and not the JSP that is causing the problem.

So, how do I clear out the applet so it loads the appropriate parameters (in this case, userB)?

Below is some sample code of what I'm doing.

public final class MyApplet extends JApplet{     public void start()   {      System.out.println( "start" );   }   public void init()   {      System.out.println( "init" );       // Set parameters coming in from the HTML file      try      {         // MyProperties is a static class which holds the parameters that get set below         MyProperties.setServerName( getParameter( "serverName" ) );         MyProperties.setUserID( getParameter( "userID" ) );      }      catch ( Exception e )      {         e.printStackTrace();      }       // Execute a job on the event-dispatching thread:      // creating this applet's GUI.      try      {         javax.swing.SwingUtilities.invokeAndWait( new Runnable()         {            public void run()            {               //Create gui, etc... in here;            }         } );      }      catch ( Exception e )      {         System.err.println( "<ERROR>:  " + e.toString() );      }    }    /**    * Executes after a page reload or when the browser closes.    */   public void stop()   {      System.out.println( "stop" );      MyProperties.removeProperties(); // Set all properties to an empty string      removeAll();      validate();      repaint();   }} 
 

Posts:254
Registered: 4/15/04
Re: Applet is caching  
Jul 2, 2004 10:56 AM (reply 1 of 5)



 
Is there some kind of auto-cache that needs to be turned off manually by each user?
 

Posts:14,142
Registered: 99-04-02
Re: Applet is caching  
Jul 2, 2004 10:57 AM (reply 2 of 5)



 
in the applet control panel, yes
 

Posts:254
Registered: 4/15/04
Re: Applet is caching  
Jul 2, 2004 12:10 PM (reply 3 of 5)



 
Is there a way to set it w/o user intervention. We wouldnt want to expose a hole like this to customers, where they can impersonate the previous user.
 

Posts:14,142
Registered: 99-04-02
Re: Applet is caching  
Jul 6, 2004 9:27 AM (reply 4 of 5)



 
no
 

Posts:14,142
Registered: 99-04-02
Re: Applet is caching  
Jul 6, 2004 9:29 AM (reply 5 of 5)



 
anyway, it shouldn't affect users. the jar files aren't specific to a user. Maybe the page has user data in it? Then you need the no-cache HTTP headers sent with the page the applet is in.
 
This topic has 5 replies on 1 page.