快捷索引

  术语Ajax用来描述一组技术,它使浏览器可以为用户提供更为自然的浏览体验。在Ajax之前,Web站点强制用户进入提交/等待/重新显示范例,用户的动作总是与服务器的“思考时间”同步。Ajax提供与服务器异步通信的能力,从而使用户从请求/响应的循环中解脱出来。借助于 Ajax,可以在用户单击按钮时,使用JavaScript和DHTML立即更新UI,并向服务器发出异步请求,以执行更新或查询数据库。当请求返回时,就可以使用 JavaScript和CSS来相应地更新UI,而不是刷新整个页面。最重要的是,用户甚至不知道浏览器正在与服务器通信:Web站点看起来是即时响应的。

  虽然Ajax所需的基础架构已经出现了一段时间,但直到最近异步请求的真正威力才得到利用。能够拥有一个响应极其灵敏的Web站点确实激动人心,因为它最终允许开发人员和设计人员使用标准的HTML/CSS/JavaScript堆栈创建“桌面风格的(desktop- like)”可用性。

  通常,在J2EE中,开发人员过于关注服务和持久性层的开发,以至于用户界面的可用性已经落后。在一个典型的 J2EE开发周期中,常常会听到这样的话,“我们没有可投入UI的时间”或“不能用HTML实现”。但是,以下Web站点证明,这些理由再也站不住脚了:

* BackPack
* Google Suggest
* Google Maps
* PalmSphere

  所有这些Web站点都告诉我们,Web应用程序不必完全依赖于从服务器重新载入页面来向用户呈现更改。一切似乎就在瞬间发生。简而言之,在涉及到用户界面的响应灵敏度时,基准设得更高了。

定义Ajax

  Adaptive Path公司的Jesse James Garrett这样定义Ajax:

  Ajax不是一种技术。实际上,它由几种蓬勃发展的技术以新的强大方式组合而成。Ajax包含:

* 基于XHTML和CSS标准的表示;
* 使用Document Object Model进行动态显示和交互;
* 使用XMLHttpRequest与服务器进行异步通信;
* 使用JavaScript绑定一切。

  这非常好,但为什么要以Ajax命名呢?其实术语Ajax是由Jesse James Garrett创造的,他说它是“Asynchronous JavaScript + XML的简写”。

Ajax的工作原理

  Ajax的核心是JavaScript对象XmlHttpRequest。该对象在Internet Explorer 5中首次引入,它是一种支持异步请求的技术。简而言之,XmlHttpRequest使您可以使用JavaScript向服务器提出请求并处理响应,而不阻塞用户。

  在创建Web站点时,在客户端执行屏幕更新为用户提供了很大的灵活性。下面是使用Ajax可以完成的功能:

* 动态更新购物车的物品总数,无需用户单击Update并等待服务器重新发送整个页面。
* 提升站点的性能,这是通过减少从服务器下载的数据量而实现的。例如,在Amazon的购物车页面,当更新篮子中的一项物品的数量时,会重新载入整个页面,这必须下载 32K的数据。如果使用Ajax计算新的总量,服务器只会返回新的总量值,因此所需的带宽仅为原来的百分之一。
* 消除了每次用户输入时的页面刷新。例如,在Ajax中,如果用户在分页列表上单击Next,则服务器数据只刷新列表而不是整个页面。
* 直接编辑表格数据,而不是要求用户导航到新的页面来编辑数据。对于Ajax,当用户单击Edit时,可以将静态表格刷新为内容可编辑的表格。用户单击 Done之后,就可以发出一个Ajax请求来更新服务器,并刷新表格,使其包含静态、只读的数据。

  一切皆有可能!但愿它能够激发您开始开发自己的基于Ajax的站点。然而,在开始之前,让我们概述一个现有的Web站点,它遵循传统的提交/等待/重新显示的范例,我们还将讨论Ajax如何提升用户体验。

AJAX is based on a collection of open and standards-based technologies that can give Web pages you build a responsiveness that rivals what you get in desktop applications. The course starts out with an exploration of the fundamentals of AJAX. Then you’ll go through a few of the more interesting features in JavaScript that will help you write code that runs in the browser. Next up is an introduction to the five server-side controls that you can use in a Web forms page to reduce the amount of data that has to move between client and server. Then you’ll explore some of the techniques you can use to create applications that give users a good experience with your Web application. Next you’ll look at the AJAX Control Toolkit, a collection of server-side controls and extenders that do a lot of the work that you used to have to write reams of JavaScript code to accomplish.

In this course, you will learn:

* A few of the more interesting features in JavaScript that will help you write code that runs in the browser
* About the server and client-side components of ASP.NET AJAX
* About avoiding full page postbacks that flash in the browser and can be intolerably slow for a user
* With your Web application how to use multiple UpdatePanel controls
* With your Web application hooking into the browser’s history feature

Prerequisites: This course assumes that you are familiar and experienced with Microsoft’s .NET Framework and ASP.NET development tools. You should be familiar with Web development and understand how HttP and HTML work to produce Web pages for the user. You should have experience writing applications with ASP.NET 3.5, 4.0, or later Web forms, and be familiar with how ASP.NET processes page requests, and have strong experience with .NET Framework 3.5, 4.0, or later programming. You should have experience with Visual Studio 2008, 2010, or later for building Web application projects. Experience with building database applications using these tools will be helpful, although not strictly necessary. You should also have some experience with writing JavaScript.

Your Instructor

Don Kiely has been using and programming computers since the mid-1970s, when he first punched IBM punch cards for batch processing to solve engineering problems. Now Don is a nationally recognized author, instructor and consultant who travels the country sharing his expertise in SQL Server and security. He has written business software using assembly, C/C++, dBASE, Nantucket Clipper, RPG II, C#, and Visual Basic for a variety of industries, and has taught software and business administration courses at community colleges. Now Don is an author and presenter for AppDev, and a consultant for a variety of companies that develop distributed applications for public and private organizations. Don is also the author or coauthor of several programming books, and a featured speaker at SQL Server conferences.

代码

引用
转自TLF

 



会员福利

资源无源时,可利用百度网盘 & 迅雷云盘取回

此内容仅供注册用户。请 %登录%.

神秘内容,请 登录 / 注册 后查看

会员可见全站福利 !


标签: , ,


文章类别:

本文链接: https://www.books51.com/188691.html

【点击下方链接,复制 & 分享文章网址】

AJAX 4使用Visual C# 2010:服务器端 视频教程 AppDev AJAX 4 Using Visual C Sharp 2010 Server Side DVD-iNKiSO iso → https://www.books51.com/188691.html

上一篇:

下一篇:

0 ratings, 0 votes0 ratings, 0 votes (0 次顶, 0已投票)
你必须注册后才能投票!
Loading...

添加新评论