<!-- /* Font Definitions */ @font-face {font-family:Courier; panose-1:2 7 4 9 2 2 5 2 4 4; mso-font-alt:"Courier New"; mso-font-charset:0; mso-generic-font-family:modern; mso-font-format:other; mso-font-pitch:fixed; mso-font-signature:3 0 0 0 1 0;} @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:NewBaskerville-Roman; panose-1:0 0 0 0 0 0 0 0 0 0; mso-font-alt:"Times New Roman"; mso-font-charset:0; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:auto; mso-font-signature:3 0 0 0 1 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体;} h1 {mso-style-next:Normal; margin-top:12.0pt; margin-right:0in; margin-bottom:3.0pt; margin-left:0in; mso-pagination:widow-orphan; page-break-after:avoid; mso-outline-level:1; font-size:16.0pt; font-family:Arial; mso-font-kerning:16.0pt;} h2 {mso-style-link:"Heading 2 Char"; mso-style-next:Normal; margin-top:12.0pt; margin-right:0in; margin-bottom:3.0pt; margin-left:0in; mso-pagination:widow-orphan; page-break-after:avoid; mso-outline-level:2; font-size:14.0pt; font-family:Arial; font-style:italic;} span.Heading2Char {mso-style-name:"Heading 2 Char"; mso-style-locked:yes; mso-style-link:"Heading 2"; mso-ansi-font-size:14.0pt; mso-bidi-font-size:14.0pt; font-family:Arial; mso-ascii-font-family:Arial; mso-fareast-font-family:宋体; mso-hansi-font-family:Arial; mso-bidi-font-family:Arial; mso-ansi-language:EN-US; mso-fareast-language:ZH-CN; mso-bidi-language:AR-SA; font-weight:bold; font-style:italic;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:1857112768; mso-list-type:hybrid; mso-list-template-ids:-683648056 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l0:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in; font-family:Symbol;} ol {margin-bottom:0in;} ul {margin-bottom:0in;} -->
google web toolkit 介绍
谭炳超
对于传统的web架构,页面请求后台服务的时候,客户端会出现页面刷新,从而
页面会出现一段白色页面,从而用户体验不完美。这样就导致了出现Ajax技术。
然而异步的 Javascript 和XML(AJAX)开发比较困难,必须要写Javasript的代码,
而且不同的浏览器对Javasript的支持有轻微的不同,开发人员可能要花费 90% 的时间来处理浏览器行话。
所以你经常看到有些网页在Firefox下会显示不完整,就是由于这个原因导致的 。
以上所有的问题就导致了GWT 的出现。GWT 的1.0版本出现在2006,现在更新到1.6版本,符合Apache2.0协议。
GWT是一个JAVA到Javascript的编译器。Javascript能得到大多数浏览器的支持。
GWT 还提供窗口小部件(widgets)来组合你的web界面,能够像MFC桌面编程那样构建web界面,这些界面都比较绚丽,友好。widgets包括:checkbox,datepicker,listbox,tree,menubar,radiobutton,tables,grid,flextable等。
gwt的缺点:搜索引擎不能搜索到你的连接,必须提供本地的HTML版本的应用。
总之,GWT使得Ajax开发更容易了。
1.下载安装
到http://code.google.com/intl/zh-CN/appengine/docs/java/tools/eclipse.html
根据Installing the Google Plugin for Eclipse步骤下载安装。
顺便提一句,google还开发了web 的3D 工具:
http://code.google.com/intl/zh-CN/apis/o3d/
2.GWT与传统的web调试
先问个问题,大家在以前开发web,如何调试写好的jsp,servlet呢 ?
GWT提供plugin插件到Eclipse里面,可以设置断点进行调试,跟踪看内存。对比
传统的web开发,写好的jsp,servlet 需要部署到容器中才能看到结果,
这个比较不直观,而且麻烦,不方便。
3.GWT 包括的内容
3.1 GWT编译器
通过这个编译器,把JAVA代码编译成javascript,而且会生成几种编译器的对应代码来屏蔽区别。
3.2 UI层
GWT 还提供窗口小部件(widgets)来组合你的web界面。
3.3 远程调用(remote procedure calls)
在RPC的开发中,可以继承序列化的接口(IsSerializable, Serializable)来序列化对象。相关的接口包括RemoteServiceServlet,AsyncCallback,RemoteService,使用这几个类可以完成与服务器的通信。
3.4 JSON(javascript object notation)
JavaScript可以执行在客户端,它与XML不同.GWT 包括JSONObject 和JSONParser。当与HTTP通信时,能集成到基于JSON的服务器资源中。
3.5 internationalization (i18n)tools
通过Constants, Messages 或 Dictionary 类, i18n 模式定义了几个接口类。然后在<extend-property> tag中添加支持的语言种类。如:添加 French 和Italian支持
<extend-property name="locale" values="fr" />
<extend-property name="locale" values="it" />
4.GWT in Eclipse
4.1 GWT界面
- 可以使用红框中的按钮来创建gwt 工程
- 可以编译编译工程
- 可以部署工程
4.2 运行GWT 工程
4.3调试GWT 工程
设断点:
触发断点,单步调试
以上的这些就是GWT的简单介绍,具体的使用还需要在实践过程中深化!
谢谢大家!