您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 项目/工程管理 > Google Web Toolkit
GoogleWebToolkitTakingthepainoutofAjaxEdBurnetteThePragmaticBookshelfRaleigh,NorthCarolinaDallas,TexasPreparedexclusivelyforTomaszPankowskiManyofthedesignationsusedbymanufacturersandsellerstodistin-guishtheirproductsareclaimedastrademarks.Wherethosedesignationsappearinthisbook,andThePragmaticProgrammers,LLCwasawareofatrademarkclaim,thedesignationshavebeenprintedininitialcapitallettersorinallcapitals.ThePragmaticStarterKit,ThePragmaticPro-grammer,PragmaticProgramming,PragmaticBookshelfandthelinkinggdevicearetrademarksofThePragmaticProgrammers,LLC.UsefulFridayLinks•Sourcecodefromthisbookandotherresources.•FreeupdatestothisPDF•Errataandsuggestions.Toreportanerratumonapage,clickthelinkinthefooter.Everyprecautionwastakeninthepreparationofthisbook.However,thepublisherassumesnoresponsibilityforerrorsoromissions,orfordam-agesthatmayresultfromtheuseofinformation(includingprogramlist-ings)containedherein.Toseewhatwe’reupto,pleasevisitusat©2006ThePragmaticProgrammersLLC.Allrightsreserved.ThisPDFpublicationisintendedforthepersonaluseoftheindividualwhosenameappearsatthebottomofeachpage.Thispublicationmaynotbedisseminatedtoothersbyanymeanswithoutthepriorconsentofthepublisher.Inparticular,thepublicationmustnotbemadeavailableontheInternet(viaawebserver,filesharingnetwork,oranyothermeans).ProducedintheUnitedStatesofAmerica.BookshelfPragmaticLovinglycreatedbygerbil#52on2006-9-11PreparedexclusivelyforTomaszPankowskiFridaysContents1Introduction11.1LifebeforeGWT......................11.2WhatGWTdoesforyou.................31.3Aboutthisbook......................32GettingStarted52.1Supportedplatforms...................52.2Installing.........................52.3Createscaffolding....................72.4Runninganddebugging.................83Hostedvs.WebMode113.1Hostedmode.......................113.2Webmode.........................133.3Obfuscation........................153.4Deployment........................164UserInterface174.1TyingintoHTML.....................174.2Entrypoint........................194.3Events...........................204.4Widgets..........................214.5Panels...........................285RemoteProcedureCalls325.1Wheredoesyourcodelive?...............325.2Callingremotecode...................335.3Whyanewprotocol?...................335.4GWTRPCbasics.....................34PreparedexclusivelyforTomaszPankowskiFridaysCONTENTSCONTENTSiv5.5Serialization........................406HistoryandBookmarks436.1TheHistoryToken....................436.2HistoryListener......................446.3HowitWorks.......................446.4Example..........................457JavaScriptNativeInterface487.1DeclaringaNativeMethod...............487.2HowitWorks.......................497.3CallingJSNIfromJava.................497.4CallingJavafromJSNI.................507.5Example..........................528JavaEmulation558.1Languagesubset.....................558.2Librarysubset......................588.3Supportedpackages...................598.4RegularExpressions...................61ReporterratumPreparedexclusivelyforTomaszPankowskiFridaysChapter1IntroductionTheGoogleWebToolkit(GWT)wasunveiledtoanunsuspectingpubliconMay18th,2006attheannualJavaOneconferenceinSanFrancisco.ThepremisebehindGWTissimple:makeAjax1develop-menteasierbyhidingbrowserincompatibilitiesfromtheprogram-merandallowingthedevelopertoworkinafamiliarJavadevelop-mentenvironment.Theannouncementwasoneofthehighlightsoftheconferenceandinterestcontinuestogrow.DevelopershaveusedGWTtechnologyineverythingfromgamestomortgagecalculators.ThegwtPoweredcommunitysitelistsover100examples,articles,widgets,andotherresources.WhyhastheGoogleWebToolkitbecomesuchahottopic?Ifyou’veeverwrittenanon-trivialAjaxapplicationbefore,thenI’msureyoucansympathizewiththeneedtomaketheprocesseasier.Ifnot,thenalittlebackgroundisinorder.1.1LifebeforeGWTDynamicwebapplicationsaretypicallywritteninseveraldiffer-entlanguagesacrosstwoormoretiers.Ontheclientside(thepartrunninginthebrowser),youhaveHTMLmarkupofcourse,1ThetermAjaxwasfamouslycoinedinFebruary2005byJesseJamesGarrett.OriginallyitwasanacronymforAsynchronousJavascriptAndXml.Thetechnol-ogyhasactuallybeenaroundforafewyears—forexampleitwasusedinOutlookWebAccessin2000—butdidn’tgetmuchattentionuntilGooglepopularizeditwithapplicationssuchasGMailandGoogleMaps.PreparedexclusivelyforTomaszPankowskiFridaysCHAPTER1.INTRODUCTIONLIFEBEFOREGWT2plusyouhavesomelogicwritteninJavaScripttoperformtaskslikeclient-sidevalidationandmanipulationoftheHTMLdocumentobjectmodel(DOM).Unfortunately,slightdifferencesintheJavaScriptlanguagebetweenJavaScriptisared-headedstep-childofalanguagethatfirstappearedintheNetscapebrowserin1995asawaytoscriptJavaapplets.ItwasadoptedbyMicrosoftinthefollowingyear,becomingthede-factostandardforscriptinginsidethebrowser.DespitehavingJavainitsname,itbearslittleresemblancetothatlanguage.TheclosestthingtoJavaScriptwouldbe...wellactuallythere’snothingquitelikeJavaScript.Somewouldcountthatasagoodthing.browsers,alongwithmajordifferenc
本文标题:Google Web Toolkit
链接地址:https://www.777doc.com/doc-6131009 .html