what is GWT as compared to jquery
IS GWT same as jquery framework or its different.
I mean i use mainly jquery for all AJAX things. IS there any good reason开发者_高级运维 to shift to GWT
Take a look at Developing with Google Web Toolkit.
Quote:
The GWT SDK provides a set of core Java APIs and Widgets. These allow you to write AJAX applications in Java and then compile the source to highly optimized JavaScript that runs across all browsers, including mobile browsers for Android and the iPhone.
Constructing AJAX applications in this manner is more productive thanks to a higher level of abstraction on top of common concepts like DOM manipulation and XHR communication.
You aren't limited to pre-canned widgets either. Anything you can do with the browser's DOM and JavaScript can be done in GWT, including interacting with hand-written JavaScript.
Reading this, now you know that you write GWT applications in Java. This is drastically different than JavaScript (or jQuery, for that matter).
How does it work? You write code in Java and the GWT compiler spits out optimized Javascript that does what you told it to do when you wrote Java code.
jQuery is different, since it is a framework/library build atop Javascript and it's here to make your life simpler by avoiding writing some tedious Javascript code like AJAX callbacks.
So, with GWT, you write Java code that gets translated into Javascript.
With jQuery, you write Javascript.
The purpose of JQuery is to load JavaScript up with lots of useful classes and helper methods for AJAX. You still write in JS and debug through whatever debug facility a browser provides.
GWT requires you write in Java which is subsequently turned into JavaScript. You can even debug your app as if it were a Java application through Eclipse. The idea is write in a strongly typed compiled language, benefit from all the features of Eclipse (refactoring source control etc.) but it still ends up being a JS application.
You can mix GWT with handwritten JS if you wish but generally speaking you wouldn't unless you were doing something which was outside of the API's scope.
and for your information, jquery was ported to GWT : GwtQuery
GWT is entirely different. In GWT you write your source code in Java. With jQuery you write your source code with JavaScript, which, despite nominal similarity, is an entirely different language. If you are comfortable with jQuery and have no particular need to change your source language to Java, I would not recommend changing.
I do belive that the most important superiority of GWT over JQuery or similar Javascript libraries is write once run on any browser convenience. GWT promise us similar to what Java has promised us 15 years ago, write once run anywhere. Even you are not java expert, instead javascript expert, I do believe that only this feature compensates the investment to GWT.
I do not even mention Java superiority over Javascript. Because Javascript proponents belive the opposite.
Google is one the key factor about GWT.
精彩评论