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

AJAXʵ¼ùDWRƪ

DWR(Direct Web Remoting)ÊÇÒ»¸öWEBÔ¶³Ìµ÷Óÿò¼Ü.ÀûÓÃÕâ¸ö¿ò¼Ü¿ÉÒÔÈÃAJAX¿ª·¢±äµÃºÜ¼òµ¥.ÀûÓÃDWR¿ÉÒÔÔÚ¿Í»§¶ËÀûÓÃJavaScriptÖ±½Óµ÷Ó÷þÎñ¶ËµÄJava·½·¨²¢·µ»ØÖµ¸øJavaScript¾ÍºÃÏñÖ±½Ó±¾µØ¿Í»§¶Ëµ÷ÓÃÒ»Ñù(DWR¸ù¾ÝJavaÀàÀ´¶¯Ì¬Éú³ÉJavaScrip´úÂë).ËüµÄ×îа汾DWR0.6Ìí¼ÓÐí¶àÌØÐÔÈç:Ö§³ÖDom TreesµÄ×Ô¶¯ÅäÖÃ,Ö§³ÖSpring(JavaScriptÔ¶³Ìµ÷ÓÃspring bean),¸üºÃä¯ÀÀÆ÷Ö§³Ö,»¹Ö§³ÖÒ»¸ö¿ÉÑ¡µÄcommons-loggingÈռDzÙ×÷.
ÒÔÉÏÕª×Ôopen-open£¬¿´Á˼¸Ì죬ȷʵÊÇÒ»¸ö·Ç³£ÓÅÐãµÄÏîÄ¿£¬Ëüͨ¹ý·´É䣬½«java·­Òë³Éjavascript£¬È»ºóÀûÓûص÷»úÖÆ£¬ÇáËÉʵÏÖÁËjavascriptµ÷ÓÃJava´úÂë¡£
Æä´ó¸Å¿ª·¢¹ý³ÌÈçÏ£º
1.±àдҵÎñ´úÂ룬¸Ã´úÂëÊǺÍdwrÎ޹صġ£
2.È·ÈÏÒµÎñ´úÂëÖÐÄÄЩÀà¡¢ÄÄЩ·½·¨ÊÇÒªÓÉjavascriptÖ±½Ó·ÃÎʵġ£
3.±àдdwr×é¼þ£¬¶Ô²½Öè2µÄ·½·¨½øÐзâ×°¡£
4.ÅäÖÃdwr×é¼þµ½dwr.xmlÎļþÖУ¬Èç¹ûÓбØÒª£¬ÅäÖÃconvert£¬½øÐÐjavaºÍjavascriptÀàÐÍ»¥×ª¡£
5.ͨ¹ý·´Éä»úÖÆ£¬dwr½«²½Öè4µÄÀàת»»³Éjavascript´úÂ룬Ìṩ¸øǰ̨ҳÃæµ÷Óá£
5.±àдÍøÒ³£¬µ÷Óò½Öè5µÄjavascriptÖеÄÏà¹Ø·½·¨£¨¼ä½Óµ÷Ó÷þÎñÆ÷¶ËµÄÏà¹ØÀàµÄ·½·¨£©£¬Ö´ÐÐÒµÎñÂß¼­£¬½«Ö´Ðнá¹ûÀûÓûص÷º¯Êý·µ»Ø¡£
6.Ôڻص÷º¯ÊýÖУ¬µÃµ½Ö´Ðнá¹ûºó£¬¿ÉÒÔ¼ÌÐø±àдҵÎñÂß¼­µÄÏà¹Øjavascript´úÂë¡£
ÏÂÃæÒÔÓû§×¢²áµÄÀý×Ó£¬À´ËµÃ÷ÆäʹÓᣣ¨×¢Ò⣬±¾´ÎÀý×ÓÖ»ÊÇÓÃÓÚÑÝʾ£¬ËµÃ÷DWRµÄʹÓã¬ÀàÉè¼Æ²¢²»ÊÇ×îÓŵģ©¡£
1.ÏȽéÉÜÏÂÏà¹ØµÄJavaÀà
User: Óû§À࣬
public class User {
//µÇ½ID£¬Ö÷¼üΨһ
private String id;
//ÐÕÃû
private String name;
//¿ÚÁî
private String password;
//µç×ÓÓʼþ
private String email;
//ÒÔÏ°üº¬getXXXºÍsetXXX·½·¨
.......
}
UserDAO£ºÊµÏÖUserµÄÊý¾Ý¿â·ÃÎÊ£¬ÕâÀï×÷Ϊһ¸öÑÝʾ£¬±àд²âÊÔ´úÂë
public class UserDAO {
//´æ·Å±£´æµÄÊý¾Ý
private static Map dataMap = new HashMap();
//³Ö¾ÃÓû§
public boolean save(User user) {
if (dataMap.containsKey(user.getId()))
return false;
System.out.println("ÏÂÃ濪ʼ±£´æÓû§");
System.out.println("id£º"+user.getId());
System.out.println("password£º"+user.getPassword());
System.out.println("name£º"+user.getName());
System.out.println("email£º"+user.getEmail());
dataMap.put(user.getId(), user);
System.out.println("Óû§±£´æ½áÊø");
return


Ïà¹ØÎĵµ£º

Ajax add_pageLoaded

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for Commen ......

Ajax ´íÎó´¦Àí

´íÎó´¦Àí
•µ÷ÓÃʱ¿ÉÒÔÌṩһ¸ö¶îÍâµÄ´íÎó»Øµ÷º¯Êý
•°üÀ¨³¬Ê±ºÍ·þÎñÆ÷¶ËÅ׳öµÄÒì³£
•³¬Ê±Ö»ÄÜÉèÖÃÔÚWebService¼¶±ð
–»òÕßÉèÖÃÔÚPageMethods¶ÔÏóÉÏ
–ÎÞ·¨ÔÚÿ¸öMethodCallʱָ¶¨
•Sys.Net.WebServiceError
–timedout¡¢message¡¢exceptionType¡¢stackTraceÊôÐÔ
ErrorHandling.a ......

Ajax¶¯Ì¬¼ÓÔØĿ¼Ê÷£¨jquery treeview£©

ÐèÇó£º
   ¶¯Ì¬¼ÓÔØĿ¼Ê÷½ÚµãÊý¾Ý¡£¼´£ºÊ÷µÄ³õʼ״̬Ϊ¸ù½ÚµãÊ÷£¬µ±µã»÷ÆäÖÐÒ»¸ö½Úµãʱ£¬ÔÙ´ÓÊý¾Ý¿âÖлñÈ¡µ±Ç°½ÚµãµÄ×ӽڵ㡣
»·¾³£º
   Struts1+Hibernate3.0+jQuery+treeview
½â¾ö·½°¸£º
1.ÎÒ×Ô¼ºµÄÏîÄ¿ÐèÇóÊÇ£º»ñÈ¡linuxµÄFTPĿ¼£¬ÒÔ¶¯Ì¬¼ÓÔصķ½Ê½È¡µÃ¸ÃFTPÉϵÄËùÓÐĿ¼¼°ÎļþÉú³ÉjsÊ÷£¬µã» ......

AjaxÈëÃÅÀý×Ó

  //´´½¨XMLHttpRequest¶ÔÏó£¬ÐèÒª¸ù¾ÝIEºÍä¯ÀÀÆ÷ÀàÐÍ´´½¨²»Í¬µÄxhr¶ÔÏó
var xhrobj;
function check()
{
//»ñÈ¡Îı¾¿òµÄÖµ
var username = document.getElementById("username").value;
if(window.XMLHttpRequest)
{
//Õë¶Ôfirefox£¬Mozilla£¬ie7£¬ie8µÈ
xhrobj = new XMLHttpRequest();
/ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ