http://www.ajaxlines.com/ajax/stuff/article/using_google_is_ajax_search_api_with_java.php
I was rather depressed over a year ago when Google deprecated their SOAP Search API with their AJAX Search API. Essentially Google was saying that they didn want anyone programmatically accessing Google search results unless they were going to be presenting the results unaltered in a rectangular portion of a website. This was particularly troubling to me because, like many academics, I have relied on the API to do automated queries, especially for Warrick.
A few months ago I got a little excited when Google opened their AJAX API to non-JavaScript environments. Google is now allowing queries using a REST-based interface that returns search results using JSON. The purpose of this API is still to show unaltered results to your website is user, but I don see anything in the Terms of Use that prevent the API being used in an automated fashion (having a program regularly execute queries), especially f ......
http://www.ajaxlines.com/ajax/stuff/article/using_google_is_ajax_search_api_with_java.php
I was rather depressed over a year ago when Google deprecated their SOAP Search API with their AJAX Search API. Essentially Google was saying that they didn want anyone programmatically accessing Google search results unless they were going to be presenting the results unaltered in a rectangular portion of a website. This was particularly troubling to me because, like many academics, I have relied on the API to do automated queries, especially for Warrick.
A few months ago I got a little excited when Google opened their AJAX API to non-JavaScript environments. Google is now allowing queries using a REST-based interface that returns search results using JSON. The purpose of this API is still to show unaltered results to your website is user, but I don see anything in the Terms of Use that prevent the API being used in an automated fashion (having a program regularly execute queries), especially f ......
function eidtPageCheckIsOrder ( serverid ){
var telephonenum = document.formx.TELPHONENUM.value;
var webWapFlag=document.formx.WEBORWAPFLAG.value;
var param=setPisaQueryString('TELPHONENUM',telephonenum,'WEBORWAPFLAG',webWapFlag,'serverid',serverid,'destFolderId',serverid);
createPisaXMLHttpRequest();
var url="/portalWeb/ajaxCheckService.do";
xmlHttp.open('POST',url,true);
xmlHttp.setRequestHeader("content-type","application/x-www-form-urlencoded");
if ( serverid == 4 )
{
xmlHttp.onreadystatechange=eidtPageCheckIsOrderEidtBack;
}
else if ( serverid == 58)
{
xmlHttp.onreadystatechange=eidtPageCheckIsOrderSaveBack;
}
else if( serverid == 60 )
{
xmlHttp.onreadystatechange=checkPersonMdidaIsOrderBack;
}
xmlHttp.send(param);
} ......
<html>
<head>
<title></title>
</head>
<mce:script type="text/javascript"><!--
var xmlHttp = false;
try{
xmlHttp = new XMLHttpRequest();
}catch(trymicrosoft){
try{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(othermicrosoft){
try{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(failed){
xmlHttp = false;
}
}
}
if(xmlHttp == false){
alert("Error initializing XMLHttpRequest!");
}
// --></mce:script>
<mce:script type="text/javascript"><!--
function callServer(){
var city = document.getElementById("city");
if(city==null||city=="") return;
var url = "do_ajax.jsp?city="+escape(city);
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange = updatePage;//onreadyStateChangeʼþÊ ......
jsÎļþ:
var where=" where pd_Isjifen=0 and pd_Isok=1"; //²éѯÌõ¼þ
var psize=16; //²éѯÊý¾ÝÊýÄ¿
var pindex=0;//µ±Ç°Ò³Êý
var order=" order by pd_Update desc,type_sort,pd_brand,pd_typeid"; //ÅÅÐòÌõ¼þ
var temp=0; //Ä£°åÃû³Æ
var Pcount=0;
//»ñÈ¡²ÎÊý
function getUrlPara(paraName)
{
var str=window.location.search;
if (str.indexOf(paraName)!=-1)
{
var pos_start=str.indexOf(paraName)+paraName.length+1;
var pos_end=str.indexOf("&",pos_start);
if (pos_end==-1)
{
return str.substring(pos_start);
}
else
{
return str.substring(pos_start,pos_end)
}
}
else
{
return "";
}
}
//ÉèÖòéѯÌõ¼þ
function Set_Where()
{
var country=getUrlPara("country");
if(country!='')
{
where+=" and pd_country='" + unescape(country) + "'";
}
var search=getUrlPara("search");
if(search!='')
{
where+=" and " + Get_where(unescape(search));
}
......
ÏîÄ¿ÖÐÏëÓÃajax£¬ÓÚÊÇÔÚÍøÉϰÇÁËn¶à×ÊÁÏ£¬·¸ÁËn¶à´íÎ󣬴ӽñÌìÉϰൽÏÖÔÚÒ»Ö±ÔÚ´¦ÀíÕâ¸öÎÊÌ⣬ÖÕÓÚ»¹ÊǰÑËü½â¾öÁË¡£
µ±ÎÒ¿´µ½Ò³ÃæµÄajaxÏÔʾºó£¬ÎÒÐË·ÜÒì³££¬ÎªÁ˼Ǽ×Ô¼ºÑ§Ï°µÄajaxÀú³Ì£¬Ò²ÎªÁËÈøü¶àµÄÈËÉÙ×ßÍä·£¬ÌØÐ´´ËÒ»ÎÄÒÔ¼ÇÖ®£¡
·Ï»°²»ËµÁË£¬ÎªÁ˸üºÃµÄÀí½â£¬ÎÒÖØ×öÁËÒ»¸öСµÄÏîÄ¿£¬ÒÔ¼ÓÉîÓ¡Ïó¡£ÏÖÔÚ¾ÍÒÔÕâ¸öСÏîÄ¿¿ªÊ¼ÎÒÃǵÄajaxÖ®Âá£
µÚÒ»²½£º´´½¨ ajax Java WebÏîÄ¿¡£
µÚ¶þ²½£º¼ÓÈëstruts2µÄjar°ü£¬ÕâÀïÐèÒªËĸö°ü freemarker.jar ognl.jar struts2-core.jar commons-fileupload.jar commons-io.jar xwork-core-2.1.6.jar£¨Õâ¸ö°ü¼ÓÉϰ汾ºÅ£¬ÊÇÒòΪÏÂÎÄÒªÌáµ½Ëü£©£¬ÕâÁù¸ö°üÊÇstruts±ØÐëÒÀÀµµÄjar°ü£¬Ê²Ã´ºÃ˵µÄ¡£
µÚÈý²½£ºÐÞ¸Ä web.xml ¼ÓÈë strutsµÄ¹ýÂËÆ÷£¬´úÂëÈçÏ£º
view plaincopy to clipboardprint?
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
& ......
ÕâÁ½ÌìÒ»Ö±ÔÚÂñÍ·¿àÁ·AJAX¼¼Êõ£¬ËäÈ»ÍøÉ϶ÔAJAXµÄ¿´·¨¸÷Óкûµ£¬ÔÚÎÒ¿´À´AJAX¶ÔÎÒÀ´Ëµ»¹ÊÇÒ»¸öºÜ²»´íµÄ¼¼Êõ£¬ËüÔںܴóµÄ³Ì¶ÈÉϼõÇáÁË·þÎñÆ÷µÄ¸ºµ££¬°ÑһЩ¼òµ¥µÄrequestͨ¹ýÀûÓÃjavascript·½·¨´´½¨Ò»¸öXMLHttpRequest¶ÔÏó·¢ËͺͽÓÊÕ·þÎñÆ÷µÄÐÅÏ¢£¬²»ÒªÍ¨¹ýË¢ÐÂÒ³Ãæ¾ÍÄܵõ½×Ô¼ºÏëÒªµÄЧ¹û£¬Õâ¼òÖ±ÊDz»¿É˼Òé¡£ÏÂÃæ¸ø³öÒ»¶ÎAJAX+Servlet+JavascriptÒ»¶Î×î¼òµ¥µÄ´úÂ빩³õѧÕ߲ο¼£¬×¢ÒâÊdzõѧÕßŶ ¡£
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict //EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sending Request Data Using GET and POST</title>
<script type="text/javascript">...
var xmlHttp;
function createXMLHttpRequest() ...{
if(window.ActiveXObject) ...{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} else if(window.XMLHttpRequest) ...{
xmlHttp = new XMLHttpRequest();
}
}
function ......