I Have tried to search keyword in frames using java program.But I am not get any solution.Please help me
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
I Have tried to search keyword in frames using java program.But I am not get any solution.Please help me
Can you explain what you are trying to do?
If you don't understand my answer, don't ignore it, ask a question.
main.html
<html>
<head>
<frameset cols="20%,*">
<frame src="a.html"/>
<frame src="b.html"/>
</frameset >
</head >
<body>
</body>
</html>
a.html
<html>
<body>
<p> Hi friends How r u?
</p>
</body>
</html>
b.html
<html>
<body>
<p>This is content
</p>
</body>
</html>
I want to search keyword content in main.html
If the contents of the html file was in a String, and you have a list of the keywords, there are methods in the String class you could use to search the String with.
There can be problems with that technique because of substrings and the use of words as text and not html tags.
There might be html parsers that would help you parse the html and extract the tags separately from other text.
You would have to ask google. I don't know if the XML parsers would work with html.
If you don't understand my answer, don't ignore it, ask a question.
with String I tried but I am not able to get the keyword
Post the code that shows the problem.
If you don't understand my answer, don't ignore it, ask a question.
Could U give the solution for this pb to find keyword with new code
--- Update ---
Hi
Could u give soln for this pb.
find keywordint indx = theString.indexOf("keyword");
If you don't understand my answer, don't ignore it, ask a question.
How it ill work? indexof will search the keyword only in main.html page.
The indexOf() method will only search the String that it is used with. The program will have to read the data into the String.
If you don't understand my answer, don't ignore it, ask a question.
If we retrieve using HttpResponse header & body then?
Do you have some code you are having problems with?
If you don't understand my answer, don't ignore it, ask a question.
yes.
String content = httpMethod.getResponseBody();
if (content.toLowerCase().contains(
device.getKeyword().toLowerCase())) {
sop("keyword \"" + device.getKeyword()
+ "\" found");
isKeywordPass = true;
}
What are the problems you are having?
Please edit your post and wrap your code with code tags:
[code=java]
<YOUR CODE HERE>
[/code]
to get highlighting and preserve formatting.
If you don't understand my answer, don't ignore it, ask a question.
I am not able to get keyword from a & b frame.
--- Update ---
Ok.If U have any idea.Please give the full code to search key word in frame
Does the program read the html pages that you are having problems with? It would need to read the contents of the html pages so it could scan them.
Last edited by Norm; April 10th, 2013 at 08:42 AM. Reason: replaced files with html pages
If you don't understand my answer, don't ignore it, ask a question.
No its not a file read from any url that contain frame n search the keyword
I meant html pages where I said files.
If you don't understand my answer, don't ignore it, ask a question.
Yes.I understand the question,but the html pages in server not local.
Is there a problem trying to read an html page using a URL to access the page?
If you don't understand my answer, don't ignore it, ask a question.
Hi,
I am facing the same problem.Before that I used content.contain("string")