Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¼±¼±£¡£¡£¡£¡ajax ÖÐÎÄÂÒÂë - Java / Java EE

ÔÚservletÖУ¬ÓÐÖÐÎÄ´«µÝµ½Ò³ÃæÖеÄjsÀïÃ棬ÔÚjsÏÔʾÖÐÎÄʱ£¬³öÏÖÂÒÂë¡£
serletÀïÃ沿·Ö´úÂ룺
Java code:

StringBuffer sb=new StringBuffer("<nprovince>");
for(City city:clist){
sb.append("<scity>").append(city.getCityId()).append("</scity>");
sb.append("<scity>").append(new String(city.getName().getBytes("iso8859-1"),"utf-8")).append("</scity>");
//´«µÝÖÐÎÄÃû³Æ¡£
}
sb.append("</nprovince>");



jspÖеÄjs²¿·Ö´úÂ룺
JScript code:

if(req.status == 200){
var city=req.responseXML.getElementsByTagName("scity");
var str=new Array();
var strname=new Array();
for(var i=0;i<city.length;i=i+2){
str[i]=city[i].firstChild.data;
strname[i]=city[i+1].firstChild.data;
alert(unescape(strname[i]));//ÖÐÎÄÂÒÂë
}
buildSelect(str,strname,document.getElementById("scity"));
}




ÔÚservletÖмÓ
response.setContentType("text/xml;charset=UTF-8");



Java code



Code highlighting produced by Actipro CodeHighlighter (freew


Ïà¹ØÎÊ´ð£º

Çë½ÌajaxʵÏÖµ¯³ö´°ÌåµÄÓ÷¨ - Web ¿ª·¢ / Ajax

°´Å¥·ÅÔÚUpdatePanel1£¬Ïëͨ¹ýµã»÷µ÷ÓÃDictionaryTvAdd.aspxµ¯³öÒ»¸ö×Ó´°Ìå
ÓÃÏÂÃæµÄÓï¾äÌáʾÎÒȱÉÙ¶ÔÏó
protected void Button1_Click(object sender, EventArgs e)
  {
  ScriptManager.R ......

¹ØÓÚAJAXºÍJSPµÄһЩСÎÊÌâ¡« - Java / Web ¿ª·¢

ÎÒJSPµÄÒ³ÃæÊÇ£º
<%@ page language="java" contentType="text/html; charset=gb2312"
  %>
<script>
function Save(){
xmlHttp=GetXmlHttpObject()
if(xmlHttp==nul ......

JAVAµç×Ӵʵ䣿 - Java / Java SE

¸÷·´óÏÀ¸ø¸ö˼·£¬²»ÊÇÔÚÏßµÄÄÇÖÖ£¬¾ÍÊÇÒ»¸ö×öÆÕͨµÄÓ¦ÓóÌÐò¡£


´Ê¿âÔõôÉú³ÉÄØ£¿

²»»á¡£

ÒýÓÃ
´Ê¿âÔõôÉú³ÉÄØ£¿
ÕÒ±¾×Öµä

ÒýÓÃ
´Ê¿âÔõôÉú³ÉÄØ£¿
Êý¾Ý¿â ºÇºÇ

ÓÃmap ¼üÖµ¶ÔÓ¦

Èç¹ûÓÃÊý¾Ý¿ ......

jspºÍtomcatÎÊÌ⣬¿ì·èÁË - Java / Java EE

ÎÒдÁ˸öjspÒ³Ã棬Ȼºó¸Ä¶¯ÁËһϣ¬¸Ä¶¯µÄÄÚÈݾÍÊÇÔÚjspÒ³ÃæµÄjsº¯ÊýÀï¼ÓÁ˸öalert()Óï¾ä£¬µ«ÊÇÎÒ·ÃÎÊÕâ¸öÒ³Ãæʱ£¬ËÀ»î¶¼ÊÇÔ­À´Ò³ÃæµÄÄÚÈÝ£¬ÎÒ¼ÓÁ˺ܶàalertº¯Êý»¹ÊÇû¸Ä¶¯Ç°µÄÒ³ÃæÄÚÈÝ£»tomcatÖØÆôÁË£¬Ò²ÖØв¿ÊðÕâ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ