I want from a "String location" take the URL obj, so run "String str = location.getContent();", and after SEARCH for a any string like words or sentence or urls, for how many times appeared on page[URL obj], can you help?
[code] private void getThePage( String location )
{
try // load document and display location
{
contentsArea.setPage( location ); // set the page
enterField.setText( location ); // set the text
String str = location.getContent();
index = str.indexOf("http://www.l-web-dev.net");
while (index !=0) {
index = str.indexOf("http://www.l-web-dev.net", index) ;
j++;
There seems to be two questions there (or maybe more). I'm going to choose the one where it appears you want to read the data returned by a URL resource. There are examples of that in the Java Networking Tutorial.
well how I may get URL source code text String(all with once, since ABOVE may content go to next line, and get wrong results...), for searching in thereafter for a substring?
You see in that code where you write each line to the console? Change it so that it appends each line to a StringBuilder instead. Then when the loop is finished, get a String from the StringBuilder.