import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.*;public class vote extends HttpServlet implements Runnable {
long candidate1=0;
long candidate2=0;
long candidate3=0;
boolean stopflag=false;
Thread t;
public void init(){
t=new Thread(new vote());
t.start();


}
public void run() {
while(true){
candidate1=100;
candidate2=(long) (candidate2+ Math.random()*10);
candidate3=(long) (candidate3+ Math.random()*10);
System.out.println("c1:"+candidate1); try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}

}


public void doGet(HttpServletRequest request,HttpServletResponse response)
                                      throws ServletException,IOException{
response.setContentType("text/html"); 
response.setHeader("refresh","5");
PrintWriter out =response.getWriter();
System.out.println(candidate1);
out.println(
"<html>"+
  "<head><title> show vote rate! </title></head>"+
   "<body><center>"+
   "<h1> Vote</h1>"+
   new Date()+"<br>"+
   "candidate1:"+candidate1+"<br>"+
   "candidate2:"+candidate2+"<br>"+
   "candidate3:"+candidate3+"<br>"+
   "</center></body></html>"
       
);
}
}就是线程里面产生的数在doGet里面读不到