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.

Results 1 to 21 of 21

Thread: Frame

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Frame

    I Have tried to search keyword in frames using java program.But I am not get any solution.Please help me


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Frame

    Can you explain what you are trying to do?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Apr 2013
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Frame

    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

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Frame

    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.

  5. #5
    Junior Member
    Join Date
    Apr 2013
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Frame

    with String I tried but I am not able to get the keyword

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Frame

    Post the code that shows the problem.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Apr 2013
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Frame

    Could U give the solution for this pb to find keyword with new code

    --- Update ---

    Hi
    Could u give soln for this pb.

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Frame

    find keyword
    int indx = theString.indexOf("keyword");
    If you don't understand my answer, don't ignore it, ask a question.

  9. #9
    Junior Member
    Join Date
    Apr 2013
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Frame

    How it ill work? indexof will search the keyword only in main.html page.

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Frame

    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.

  11. #11
    Junior Member
    Join Date
    Apr 2013
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Frame

    If we retrieve using HttpResponse header & body then?

  12. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Frame

    Do you have some code you are having problems with?
    If you don't understand my answer, don't ignore it, ask a question.

  13. #13
    Junior Member
    Join Date
    Apr 2013
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Frame

    yes.
    String content = httpMethod.getResponseBody();


    if (content.toLowerCase().contains(
    device.getKeyword().toLowerCase())) {

    sop("keyword \"" + device.getKeyword()
    + "\" found");
    isKeywordPass = true;
    }

  14. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Frame

    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.

  15. #15
    Junior Member
    Join Date
    Apr 2013
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Frame

    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

  16. #16
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: 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.

  17. #17
    Junior Member
    Join Date
    Apr 2013
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Frame

    No its not a file read from any url that contain frame n search the keyword

  18. #18
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Frame

    I meant html pages where I said files.
    If you don't understand my answer, don't ignore it, ask a question.

  19. #19
    Junior Member
    Join Date
    Apr 2013
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Frame

    Yes.I understand the question,but the html pages in server not local.

  20. #20
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Frame

    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.

  21. #21
    Junior Member
    Join Date
    Apr 2013
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Frame

    Hi,
    I am facing the same problem.Before that I used content.contain("string")

Similar Threads

  1. Image without a frame, is it possible?
    By knightmetal in forum AWT / Java Swing
    Replies: 5
    Last Post: August 15th, 2012, 03:52 AM
  2. Frame not becoming invisible
    By sbjibo in forum What's Wrong With My Code?
    Replies: 14
    Last Post: June 27th, 2012, 11:58 PM
  3. frame deactivation
    By deependeroracle in forum AWT / Java Swing
    Replies: 5
    Last Post: May 13th, 2012, 07:37 AM
  4. Replies: 1
    Last Post: January 19th, 2012, 03:44 PM
  5. Filling the frame
    By Metadeth in forum AWT / Java Swing
    Replies: 2
    Last Post: July 11th, 2011, 03:28 PM