I have done reading part , it is just to apply few conditions

this is a code to read html from the passed url ..

if i want to check weather page is loaded fully or not like by checking closing </html> tag present on the page or not..like how we will check it in this code.. i could not be able to capture the right step...and to check if there is any "submit error" kind of word on the page.. how we will do it..

please study it.. and work it out..

import java.io.BufferedReader;

import java.io.InputStreamReader;

import java.net.URL;

import java.net.URLConnection;

public class URLConnectionReader {

public static void main(String[] args) throws Exception {

URL yahoo = new URL("http://www.yahoo.com/");

URLConnection yc = yahoo.openConnection();

BufferedReader in = new BufferedReader(new InputStreamReader(yc

.getInputStream()));

String inputLine;

while ((inputLine = in.readLine()) != null) {

System.out.println(inputLine);

in.close();

}

if (((inputLine = in.readLine()) == null)) {

System.out.println("blank page");

}

}

}

Yogesh

[1123 byte] By [yogeshida] at [2007-11-27 4:31:04]
# 1
while ((inputLine = in.readLine()) != null) {System.out.println(inputLine);in.close();}closing in the while loop? :p
calvino_inda at 2007-7-12 9:40:29 > top of Java-index,Java Essentials,Java Programming...
# 2

oh sorry...

that was ..

while ((inputLine = in.readLine()) != null)

System.out.println(inputLine);

in.close();

it reads the html but i want to check for weather website name i will insert ends up with </html> or not .. i mean page is loaded fully or not or submit error kind of thing coming on page or not..

yogeshida at 2007-7-12 9:40:29 > top of Java-index,Java Essentials,Java Programming...
# 3

to know if the "</html>" tag is in here, you can do:

boolean htmlEnd = false;

while ((inputLine = in.readLine()) != null) {

System.out.println(inputLine);

if (inputLine.indexOf("</html>") != -1)

htmlEnd = true;

}

in.close();

calvino_inda at 2007-7-12 9:40:29 > top of Java-index,Java Essentials,Java Programming...
# 4
can you suggest me how should i check "submit error" or blank page scenerio .. mean should i follow the same methods or something else can be used...
yogeshida at 2007-7-12 9:40:29 > top of Java-index,Java Essentials,Java Programming...
# 5

maybe look at the source of pages with such error, try to find something (like special tags) that can be used as an "identifier" for these pages, and combine this identifier with the method i gave you

though, there might be some smarter way of doing it ; i just don't know a lot about html code reader in java ^^

calvino_inda at 2007-7-12 9:40:29 > top of Java-index,Java Essentials,Java Programming...