Frontend

GWT的Context Path问题

1. 在GWT的JAVA代码里取得Context Path    //若生成的JS所在目录为war/moduleName path = GWT.getModuleBaseURL().replace("/" + GWT.getModuleName(),""); //若生成的JS所在目录为war/gwt/moduleName path = GWT.getModuleBaseURL().replace("/gwt" + "/" + GWT.getModuleName(), ""); 2.在module xml里引用context path下的css文件时,用“..”来代表上级目录            <stylesheet src="../stylesheet/xxx.css" />

无法在GWT的dev mode下Debug的原因

用dev mode 以debug的方式启动程序,然后在 entry point处设断点,最后访问使用了这个module的页面,但Eclipse却不会在预期的地方断开,为什么? 一般来说这都是因为你的页面里所引用的js文件并没有指向dev mode编译出的文件所在的目录。 dev mode编译出的文件都放在 war/moduleName下,你的HTML里是不是把 moduleName.nocache.js 的路径写错了?

Learning Dojo — 4. DOM APIs

1. Select Node API   a.dojo.byId()   b.dojo.query("div.question p")       i.The parameter here should apply to CSS3 Selector      ii.This function always returns a NodeList, even if there is only one node selected 2. Attributes Operation    dojo.attr(), dojo.hasAttr(), dojo.removeAttr() … 3. CSS Operation   dojo.style(), dojo.hasClass(), …. 4. Insert/Remove Nodes    dojo.place(newNode, parentNode, "last");… …

Learning Dojo — 4. DOM APIs Read More »

Learning Dojo — 5. Remote Scripting (AJAX)

1. Remote Scripting is not just AJAX . There are 3 ways.    a.XHR(AJAX) -> Same-Origin Limited    b.iframe    -> Same-Orignin Limited; It can post a file.    c.Loading a script element ->  Not limited to Same-Origin Policy 2. XHR with dojo      a. Example dojo.xhrGet({ url: "demo/id2", handleAs: "json", handle: handler4 });      b. …

Learning Dojo — 5. Remote Scripting (AJAX) Read More »

Learning Dojo — 3.1 Core features of the Dojo language

1. Module(Package) name <==> the javascript file’s  path/filename 2. A module is always DEFINED in a single file, althought its implemenation can go into several files 3. The "dojo" module has to be loaded before any other modules, and it’s not loaded by "dojo.require", but by the script tag     <script type="text/javascript" src="xxx/dojo/dojo.js"/> 4. You …

Learning Dojo — 3.1 Core features of the Dojo language Read More »

Learning Dojo — 3.2 OO APIs

1. dojo.hitch:  Takes a function as the parameter and execute it var alerter = { doAlert: function(){ alert("something"); } } dojo.hitch(alerter, doAlert); 2. Array methods: dojo.forEach(), dojo.every(), and so on 3. Type methods: dojo.isString(), dojo.isArray()… 4. Object Coping: dojo.mixin(), dojo.clone()…

Learning Dojo — 3.3 Asynchronous Programming

1. Handling dom events   a.Define the event handler function alertSomeEvent(){ alert("someEvent"); }   b.Connect some event to the handler function connect(){ dojo.connect(dojo.byId("someButton"),"click", alertSomeEvent); }   c.Register this connection when dom tree initialization is done          dojo.addOnLoad(connect); 2. Handling user-defined events    It’s similar with handling dom events, only that the events here user-defined functions …

Learning Dojo — 3.3 Asynchronous Programming Read More »