the job is: open an URL, write parameter to it, and read the input from URL. Bleow please find my code.
The problem is: there will be 3 pages inputed from URL, Page 1 -> Page 2 -> Page 3, each switches to the next page automatically, but may take a few seconds to minutes. With my code, the program ended up by printing Page 1. But only Page 3 is what i need.
How can i print out Page 3? In other word, how can i loop, checking the working status and print the Page 3 (there are special tags in each page)? Java is not a real time platform, right?
thanks
Jing (my email: zhangjingwen@hotmail.com)
my code below
.....................................................................
try {
Parameter p = new Parameter();
String parameter = p.getParameter();
String blastURL = "http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?CMD=Put";
URL url =new URL(blastURL + parameter);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.getOutputStream().flush();
connection.getOutputStream().close();
BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine ="";
while ((inputLine = br.readLine()) != null){
System.out.println(inputLine);
}
br.close();
}
catch (Exception e) {e.toString();}