Solved

servlet code to return search results on the same page

Posted on 2004-10-04
2
963 Views
Last Modified: 2008-01-09
I have code in my servlet which getting search string from client and redirecting this search string to Google ( using response.sendRedirect(URL) ) to run the search.

basically I am redirecting to following URL :

"http://www.google.com/search?q=" + searchString

When I am doing a redirect, browser returning google website with search results.

I'd like my servlet to retrieve search results from Google and  display them on my own page, but not on Google page.

Does anyone know how to do that ?

I really appreciate your help.

Thanks.  
0
Comment
Question by:egorelik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
gdrnec earned 100 total points
ID: 12219031
There are two ways that I know of. The first is much easier. Google has a java api that you can use that will return results as objects to your java code. I have used it in the past and it works a treat http://www.google.com/apis/ 

The other way is far more complicated and involves a good deal of parsing but if instead of redirecting, you actually open the URL, get its inputStream and parse the HTML results, you can scrape the search results off the page and then do what you want with them.

I suggest the API.

Geoff
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
Part One of the two-part Q&A series with MalwareTech.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question