Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 895757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:36:38+00:00 2026-05-15T14:36:38+00:00

how to get description/content of web page for given URL. (Something like Google gives

  • 0

how to get description/content of web page for given URL.
(Something like Google gives the short description of each resulting link).
I want to do this in my jsp page.

Thank in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T14:36:39+00:00Added an answer on May 15, 2026 at 2:36 pm

    Idea: Open the URL as a stream, then HTML-parse the String in its description meta tag.

    Grab URL content:

    URL url = new URL("http://www.url-to-be-parsed.com/page.html");
        BufferedReader in = new BufferedReader(
                    new InputStreamReader(
                    url.openStream()));
    

    Will need to tweak the above code depending on what your HTML parser library requires (a stream, strings, etc).

    HTML-Parse the tags:

    <meta name="description" content="This is a place where webmasters can put a description about this web page" />
    

    You might also be interested in grabbing the title of that page:

    <title>This is the title of the page!</title>
    

    Caution: Regular expressions do not seem to work reliably on HTML documents, so a HTML-parser is better.

    An example with HTML Parser:

    1. Use HasAttributeFilter to filter by tags that have name="description" attribute
    2. try a Node —> MetaTag casting
    3. Get the content using MetaTag.getAttribute()

    Code:

    import org.htmlparser.Node;
    import org.htmlparser.Parser;
    import org.htmlparser.util.NodeList;
    import org.htmlparser.util.ParserException;
    import org.htmlparser.filters.HasAttributeFilter;
    import org.htmlparser.tags.MetaTag;
    
    public class HTMLParserTest {
        public static void main(String... args) {
            Parser parser = new Parser();
            //<meta name="description" content="Some texte about the site." />
            HasAttributeFilter filter = new HasAttributeFilter("name", "description");
            try {
                parser.setResource("http://www.youtube.com");
                NodeList list = parser.parse(filter);
                Node node = list.elementAt(0);
    
                if (node instanceof MetaTag) {
                    MetaTag meta = (MetaTag) node;
                    String description = meta.getAttribute("content");
    
                    System.out.println(description);
                    // Prints: "YouTube is a place to discover, watch, upload and share videos."
                }
    
            } catch (ParserException e) {
                e.printStackTrace();
            }
        }
    
    }
    

    Considerations:

    If this is done in a JSP each time the page is loaded, you might get a slowdown due to the network I/O to the URL. Even worse if you do this each time on-the-fly for a page of yours that has many URL links in it, then the slowdown could be massive due to the sequential operation of n URLs. Maybe you can store this information in a database and refresh them as needed instead of doing in it on-the-fly in the JSPs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On the web page i have <meta name=description content=Learn about 94.100.179.159 /> how can
I have a html web page url http://teluguone.com/recipes/content/Andhra-Spicy-Mutton-Curry-Recipe-6-221.html I need to extract Description text
How can i get Image tag from html String. I am getting description like
I want to get all the meta information like description, title, keyword etc of
How does Google find relevant content when it's parsing the web? Let's say, for
Description: If we use java objects jruby get permgen too: System.out.println(Initialazing..); //Spring applicaton context
Here's the error I get: Description: An error occurred during the compilation of a
I get the following error messages when I run the app: Description Resource Path
I want to get the Name and Description in the center of the columns..
How to get game center achievements description into NSString?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.