話說因為在學校接了某個計劃,必須實作出一個 web 的介面讓使用者輸入資料。正當我苦惱著該不會又要去用 PHP 等等東西吧,學長這時候提到,他們公司之前都是用 Google Web Toolkit 來產生出網頁的,因緣機會下,為了偷懶,順便玩玩新東西,我也開始摸這個神奇的新玩意 (對我而言是新玩意,但對其他人可能只是個老梗。)
首先我們來看看 Google 對自己 toolkit 的介紹:
Google Web Toolkit (GWT) is an open source Java development framework that lets you escape the matrix of technologies that make writing AJAX applications so difficult and error prone. With GWT, you can develop and debug AJAX applications in the Java language using the Java development tools of your choice. When you deploy your application to production, the GWT compiler translates your Java application to browser-compliant JavaScript and HTML.

簡單的說,我們可以使用 Java 的開發工具來開發 AJAX,Google 提供了一套 compiler,幫我們將 Java 轉成 JavaScript。如此一來,我們就可以避免寫了一堆爛掉的JavaScript,卻不知道從哪裡抓 bug 的窘境。而且可以套用現成的 Java IDE 如 Eclipse 等,更容易開發我們想要的東西了。 GWT 本身有內嵌一個 Tomcat,執行的時候會先出現一個 development shell,提供 server 端的行為,然後再出現一個 browser 來秀出 client 端的東西。這點倒是挺方便的,電腦本身不需要自己架個 web server,內嵌的 Tomcat 就可以把這些事情處理的很好。等到開發完再 compile 並丟到真正的 web server 上面。

這於 GWT 提供了哪些功能?讓我們來瞧瞧吧:

1. Dynamic, reusable UI components
不用自己設計 UI 了,對我這種懶人不啻是一大福音 XD。再利用 css 就可以設計出自己想要的樣子。而 GWT 本身也提供相當多種的 UI,一般我們常見的幾乎都有。

2. Really simple RPC
利用這套簡單的 RPC,client 和 server 可以進行非同步的溝通,client 可以一邊收資料,一邊產生網頁。可以增進效率。根據我自己實作過後,GWT 確實把 RPC 包的相當簡單好用。

3. Browser history management
No, AJAX applications don't need to break the browser's back button. GWT lets you make your site more usable by easily adding state to the browser's back button history.

4. Real debugging 其實這就是 GWT 最大的特色,用 Java 來寫 JavaScript,因此 debug 容易許多啦!

5. JUnit integration GWT's direct integration with JUnit lets you unit test both in a debugger and in a browser...and you can even unit test asynchronous RPCs.

6. Internationalization
Easily create efficient internationalized applications and libraries.

7. Interoperability and fine-grained control If GWT's class library doesn't meet your needs, you can mix handwritten JavaScript in your Java source code using our JavaScript Native Interface (JSNI).

8. Google API Library:
Google Gears support We are in the process of building support for using Google APIs in GWT applications. Initially, we are providing support for Google Gears, the recently-launched developer product that extends the browser to allow developers to make web-based applications function even while offline. If you would like to download this library please visit the open source project. We are planning to add support for other Google APIs; if you'd like to help, please check out Making GWT Better.

9. Completely Open Source
GWT 本身是以 Apache 2.0 open source license 發佈的,也可以用來開發商業用的程式。 以上有些是英文的,是我直接從官網上 copy 下來的。畢竟我自己目前也沒用過那些功能,就先看看 Google 老大怎麼吹噓自己的東西。總而言之,對於我目前做計劃,這套 GWT 看來是相當的夠用了,也省掉我自己去學 AJAX 的麻煩。以我的個性,對於這種 debug 困難的玩意,應該會懶的摸吧 XD。

GWT 官方網頁:code.google.com/webtoolkit/
官方網站,有許多的文件與資料,想摸摸 GWT 必看的地方。Google 的文件寫的挺紮實的,而範例也都很漂亮的介紹了各種 GWT 的特性。

36 GWT Tutorials:blogs.pathf.com/agileajax/2007/07/36-gwt-tutorial.html
"While the excellent GWT in Action was released last month, there are lots of people that want to get their feet wet before plunking down $50 for a book."
這個網頁整理的相當好,而文章一開頭也寫的很好笑 XD。
arrow
arrow
    全站熱搜

    zwai 發表在 痞客邦 留言(13) 人氣()