Wednesday, February 22, 2006

GregZ Weblog

GregZ Weblog: "GoogleSearch Portlet
The new tutorial, 'Building a GoogleSearch Web Service Portlet', outlines how to use the Google Search web service bundled with Java Studio Creator. For simplicity, the tutorial focuses on using the doSpellingSuggestion method to return a spelling suggestion for the input text using the Google Search API. This example can be expanded to use the more popular search feature of the Google APIs (doSearch).

The PortletPage1 can be re-used for the most part. Change the button to say 'Search'. Change session property to 'query'. Instead of calling the web service on page 1 and binding the result to the session bean, we will bind the query request that is input into the text field and pass it to page 2. On page 2 in init, we call doGoogleSearch, passing your Google license key and the query string from page 1. We can populate an 'Object Array Data Provider' with the array of results the method returns. For instance,"