| #
Google Tag Library

Overview Download Documentation HowTo Javadoc TLD About
Find on this site:
|  |  | Google Tag Library HowTo
Contents
1. Search & Display the Results of a Google Search 1.1 Create a Search Form 1.2 Create a Result Page 1.3 Display the Results 2. Display a Page Cached by Google 2.1 Create a Search From 2.2 Create a Result Page 2.3 Display the Cached Page 3. Display a Google Spelling Suggestion 3.1 Create a Search Form 3.2 Create a Result Page 3.3 Display the Spelling Suggestion
1. Search & Display the Results of a Google Search
> 1.1 Create a Search From | Back to top
> Create the following HTML form on your search page:
> | `<form action="results.jsp" > <input type="text" name="q"> <input type="submit" >``</form>` |  |
> The q parameter is required and used to store the search query string. The form action points to the results.jsp page, which is created in step 1.2. The Google Web APIs authentication key can be specified as an hidden form input parameter:
> | `<input type="hidden" name="key" value="000000000000000000000000">`
> 1.2 Create a Results Page | Back to top
> Create a page called results.jsp containing:
> | `<%@taglib uri="/google-taglib" prefix="google"%> <google:search/>`
> The taglib directive is used to specify the Google Tag library reference and prefix. The <google:search/> tag is used to perform the query. The Google Web APIs authentication key can be specified as a tag attribute:
> | `<google:search key="000000000000000000000000"/>`
> 1.3 Display the Search Results | Back to top
> | `<ol> <google:searchResult> <li><google:element name="title-url"/></li> </google:searchResult> </ol>` |  |
The <google:searchResult/> tag is used to loop through the results. The <google:element/> tag is used to display the attributes of the current result set element.
2. Display a Page Cached by Google
> 2.1 Create a Search From | Back to top
> Create the following HTML form on your search page:
> | `<form action="results.jsp" > <input type="text" name="q"> <input type="submit" >``</form>` |  |
> The q parameter is required and used to store the search query string. The form action points to the results.jsp page, which is created in step 2.2. The Google Web APIs authentication key can be specified as an hidden form input parameter:
> | `<input type="hidden" name="key" value="000000000000000000000000">`
> 2.2 Create a Result Page | Back to top
> Create a page called results.jsp containing:
> | `<%@taglib uri="/google-taglib" prefix="google"%>`
> The taglib directive is used to specify the Google Tag library reference and prefix.
> 2.3 Display the Cached Page | Back to top
> | `<google:cachedPage/>` |  |
> The <google:cachedPage> tag is used to display the content of the cached page. The Google Web APIs authentication key can be specified as a tag attribute:
> | `<google:cachedPage key="000000000000000000000000"/>`
3. Display a Google Spelling Suggestion
> 3.1 Create a Search Form | Back to top
> Create the following HTML form on your search page:
> | `<form action="results.jsp" > <input type="text" name="q"> <input type="submit" >``</form>` |  |
> The q parameter is required and used to store the search query string. The form action points to the results.jsp page, which is created in step 3.2. The Google Web APIs authentication key can be specified as an hidden form input parameter:
> | `<input type="hidden" name="key" value="000000000000000000000000">`
> 3.2 Create a Result Page | Back to top
> Create a page called results.jsp containing:
> | `<%@taglib uri="/google-taglib" prefix="google"%>`
> The taglib directive is used to specify the Google Tag library reference and prefix.
> 3.3 Display the Spelling Suggestion | Back to top
> | `<google:spelling/>` |  | long knives
> The <google:spelling> tag is used to display the suggested spelling for the given query. The Google Web APIs authentication key can be specified as a tag attribute:
> | `<google:spelling key="000000000000000000000000"/>`