Google offers a Google Web API development kit with a core for Web Service technology. If you don't understand the Web Service technology, don't be familiar with XML, don't tighten, Googleapi.jar in the development package has provided us with Java access. Google Tag Library is an open source project, providing a simpler and convenient JSP tag library above GoogleApi.jar. We will build your own search system with Googleapi.jar and Google Tag Library as the core.
Install Tomcat
Download Tomcat: http://jakarta.apache.org/tomcat/, please refer to its related documentation.
Two Google Web API Development Kit
The Google Web API development package is free to individual non-commercial purposes, first access the Google Development Package download page, download the development package locally. Google limits that there is a license key to use it normally. Let's register a account first, get license key, Google sends this license key to your registered mailbox. This license key is also limited to 1000 times a day.
Three installations Google Tag Library
Visit the Google Tag Library site, for convenience, I downloaded the WAR file directly, this WAR file contains a simple JSP example, which can be used directly. I downloaded Google-examples-1.0.1.war.zip, extracting this file into the Tomcat / WebPAPP directory and is renamed as Google. Then put GoogleApi.jar in the Google Web API development package in the Tomcat / WebApps / Google / Web-INF / LIB directory.
Then modify the Tomcat / WebApps / Google / Web-INF / Web.xml file, enter the license key, put
Modify (assuming my license key is 0000000000000000000000)
If you need a proxy to access Google, you can set your proxy parameters in web.xml, here is not fine:
First start Tomcat, then access http: // localhost: 8080 / google / advanced.html, you will see a search page similar to Google, enter keywords you want to search, see if you return the information you need.
Five customization
The example provided by Google Tag Library is relatively simple, and there is a problem in Chinese processing, you need to customize and modify it. First, put the advanced.html file
change into
Then put
<% @ Page ContentType = "Text / HTML; Charset = UTF-8"%>
Added to the top of the Advanced.jsp file. At the same time, you can modify the display style of the page according to your own preference, you need to pay attention to the files must be saved in UTF-8, otherwise the Chinese will not display correctly. Finally, look at the custom search system:
Summary
Only a simple introduction is made here, and there are still many features that have not been displayed, and interested friends can refer to the relevant documentation. If you have any questions and questions, you can send me a mail to Wayne@sentom.net or in our forum http://www.sentom.net/forum.