Hi,
In applet's thread part I am polling for var.
if that var is true I have to refresh/reload the servlet.
I am getting an event in run(), but I don't know how to refresh/reload
the servlet from the applet ???


my main.html look like,
---------------
<html><head><title>u </title></head>
<frameset cols="20%, 80%">
    <frame src="ra1.html" name="index" marginwidth="1" marginheight="1">
<frameset rows="18%,82%">
    <frame src="myApplet.html" name="index" marginwidth="1" marginheight="1" 
scrolling="no">
    <frame src="startservlet.html" name="index" marginwidth="1" marginheight="1">
    <noframes> </noframes></frameset></html>
--------------
and startservlet.html looks,
<HTML><HEAD><TITLE>Login Area</TITLE></HEAD>
<BODY BGCOLOR="#FFCC99"><center>
<h1>Login</h1>
<form name="frm_Login" method="get" action="http://mymachine/servlet/myServlet">
User name:<Input type="text" name="userName" size="20" >
<br>
UserId: <Input type="text" name="userId  " size="20">
<br>
<input type="submit" name="btn_Submit" value="Submit">
</form></center></Body></html>
-----------------------------------------------------------------
myapplet.html looks,
<html><applet code="RefreshApplet" width=200 height=200> </applet> </html>
------------------
RefreshApplet.java looks,
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class RefreshApplet extends Applet implements Runnable {
  public static boolean staticVar = false;
  Thread thread;
  //Construct the applet
  public RefreshApplet() {
    System.out.println("RefreshApplet: constructor");
    this.setLayout(new BorderLayout());
    this.add(ok, BorderLayout.NORTH);
    show();
    start();
  } // constructor

  public void paint(Graphics g) {
    g.drawString("Hi I am Applet", 10, 10);
  } // paint()

      public void start() {
    System.out.println("RefreshApplet: start()");
    if ( thread == null ) {
      thread = new Thread(this); thread.start(); } // if
  } // start()

  public void stop() {
    if ( thread != null ) { thread.stop(); thread = null;  } // if
  } // stop()

  public void run() {
   System.out.println("RefreshApplet: run");
    while ( true ) {
    try {
      if ( staticVar == true ) {
        System.out.println("RefreshApplet: var is true. so start refresh");
// this point I want to refresh the servlet
        staticVar = false;
      } // if
      } catch(Exception e) { System.out.println("Ex="+e); }
      try { Thread.sleep(2000); } catch(InterruptedException io) { }
    } // while
  } // run()
} // End Of Class RefreshApplet
--------------------------------------------------------


Thanx in advance

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to