読み物小舖 -- DWR


AJAX, 最近很多人都在討論 ... 拜Google所賜, 這幾年吵到翻.

根據梁大師預測, 這東西一定會成為主流, 既然梁公都這麼說了, 小子我輩等怎可不仔細研讀呢 ... 拜讀拜讀


AJAX的定義是啥? 全名叫做Asynchronized Javascript and Xml, 最佳代言人即是Google系列產品.

DWR, 是由Getahead出品, 這家公司(或組織?)也很有趣, 他們說自己是

Getahead is a small family run IT consultancy.
Joe Walker - Java/J2EE Architecture and Development
Mark Goodwin - Java/Embedded/Security Development

是的, 兩個人 ... 嚇死人, 兩個人就可以搞出這些名堂, 但是我覺得是假名字, 怎麼一個叫做"喬步行者", 一個叫做"馬克好贏" ???

AJAX到底有多紅, Getahead的比喻真正好 -- AJAX is the buzz-word of the moment to web developers. (最近這名詞真的嗡嗡叫到一個程度, 覺得耳朵有點癢了)

The problem for the web developer is that while this is a very attractive way of creating web-sites,
and one where you can get started without a huge amount of effort,
there are a number of pitfalls which can make life harder for them.
All of the browsers have different quirks, so you can easily discover that you have
locked Mac users out of the party.

對Web開發者而言, 問題在於當這已經是一個非常吸引人的建立網站技術, 而且你可以不用花太多力氣就可以開始, 還是會有一些讓你生活變困難的圈套存在.
所有的瀏覽器都有不同的警語, 所以你可以輕易的發現, 你已經把MAC使用者趕出派對了(用MAC的人站起來阿...)

DWR consists of two main parts: JavaScript running in the user's browser to communicate with the server
and dynamically update the webpage, and a Java Servlet running on the server that processes requests and
sends responses back to the browser.

DWR和大多支援AJAX的framework一樣, 透過JavaScript作為瀏覽器與伺服器之間的橋樑, 包含更新網頁上的內容等. J2EE的Servlet, 則是伺服器端處理request與response的機制.

DWR is a Java open source library which helps developers wanting to write web sites that include AJAX technology.
It allows code in a web browser to use Java functions running on a web server as if it was in the browser.
DWR consists of two main parts: JavaScript running in the user's browser to communicate with the server and dynamically update the webpage, and a Java Servlet running on the server that processes requests and sends responses back to the browser.
DWR takes a novel approach to AJAX by dynamically generating JavaScript code based Java classes.

利用Java code動態產生Javascript, 因此才能利用JavaScript使用JAVA的功能, 就好像你只是操作普通HTML網頁一樣(這段我翻的很爛).

早期AJAX常為人詬病的就是安全性, 這邊特別提醒大家For security reasons the web developer must configure exactly which Java classes are safe to export. 可千萬別以為會寫程式就好, 也要注意這種東西阿.


說明DWR是如何改變下拉式選單的內容, 就好像用JavaScript的onclick一樣. 仔細看左右兩邊可有相關聯的地方喔.

Deploy DWR真的很簡單, 下載jar檔然後設定一些web.xml和dwr.xml就可以了.
1. dwr.xml內定義了在DWR內可以用Javascript來create和remote的class.
The DWR config file defines what classes DWR can create and remote for use by Javascript.
2. 避免使用Javascript保留字.
Avoid reserved JavaScript words; Methods named after reserved words are automatically excluded. Most JavaScript reserved words are also Java
reserved words, so you won't be having a method called "try()" anyway. However the most common gotcha is "delete()", which has special meaning from JavaScript but
not Java.

3. 避免overload methods.
Overloaded methods can be involved in a bit of a lottery as to which gets called, so avoid overloaded methods.

JIRA and Confluence : 這我很訝異, 真的 ... 雖然聽說部門有裝起來這兩樣東西, 但目前還沒看到url在哪.
Demo Portal : www.claudehussenet.com , 很有意思的一個網站, 用Direct Web Remoting,Spring Framework and Hibernate架構而成, 其實這就是我想要做的, 正在研究中.

DWR官方網站上的範例, 很清楚明白的告訴我們DWR是如何透過JavaScript呼叫Java Class處理request與reponse, 然後再把結果丟回網頁上.

読み物小舖 -- Are you ready to use Liferay ???


說真的, 到底怎樣可以決定是否要用某個技術? 又怎樣可以決定風險與時程的弔詭化學作用?
但真正的重點會是在 ... 你準備好了嗎? 做專案不是搞Lab, 不求百分之百掌握, 但50%是一定要的.

讓我們從Liferay的功能開始說起, 看看有多少東西是我們沒碰過的 ... 可怕死了 ... 要拿客戶當白老鼠


JSR 168 (Portlet API) Compliant

You can hot deploy any JSR 168 compliant portlet. This means you can provide more functionality to your end users by writing custom portlets. Or, you can deploy portlets that you buy from a portlet vendor.
遵守JSR168, 可為你的客戶製作客製化的portlet, 或向portlet廠商購買&Deploy portlet.

WSRP Compliant

WSRP is a web services standard that allows you to publish portlets from your portal to external portals and allows you to consume portlets in your portal from external portals. This allows you to buy and sell portlet functionality as a service.
遵守WSRP, 這是一個web service標準, 讓你可以發布自己Portal上的portlet到外面的Portal, 而且從外部的Portal消費你的Portal的portlet, 讓你可以買賣porlet.


Liferay provides content management system functionality via a set of portlets that give your organization a flexible templating tool built on top of XSLT technologies. This allows you to build your site while cleanly separating content from the look and feel of a site. This page is served by the CMS tool. We will be JSR 170 (CMS API) compliant after the specification is finalized.
提供CMS, 經由一組porlets讓你有組織與彈性的建立自己的site, 透過XSLT技術, 可定義彈性的template, 讓內容與外觀分離.


Liferay provides a hot deployable theme architecture that allows you to change the look and feel of the portal without modifying Liferay's core code. Graphic designers can easily mock up new themes because all of our pages utilize DIVs and CSS standards.
提供hot deployable主題架構, 讓你不用修改程式即可變化Portal外觀. 由於所有的頁面都是採用div和css標準, 因此圖形設計者也可輕易製作.


Liferay provides a built in connector for CAS, Yale's single sign on engine. You can write custom hooks to integrate with other SSO engines like Netegrity.
Liferay can also synchronize its user list between the portal and an external data source like another database or LDAP server. A default connector for Microsoft Exchange is bundled with the portal.
提供CAS(耶魯的SSO engine)的連接器. 你可以製作hook來Integrate with 其他的SSO. 也可同步user list於Portal和其他資料庫或LDAP. Portal內建一個預設Microsoft Exchange的連接器.

ASP Model

Liferay was designed from the ground up to be used by application service providers. This means you can host multiple instances of the portal (distinguished by unique URLs) on one application server and database.

Application Server Agnostic

Unlike portals that come from application server vendors, Liferay is designed to be application server agnostic so you are not locked into a specific server. Liferay will work on lightweight servlet containers like Jetty and Tomcat, or on J2EE compliant servers like Borland ES, JBoss+Jetty/Tomcat, JOnAS+Jetty/Tomcat, JRun, OracleAS, Orion, Pramati, RexIP, Sun JSAS, WebLogic, and WebSphere.

An added bonus of being a Java portal means Liferay will work on many operating systems: BSD (FreeBSD, NetBSD, OpenBSD), Linux (Fedora, Novell), Solaris, Mac OS X, and Windows.
Liferay不綁死於特定的application server, 可運作於多種servlet container或J2EE server, 和多種OS.

Spring, EJB, and AOP

Liferay's business beans are built on top of Spring. This allows you to leverage Spring's AOP, IOC, and proxy features to customize Liferay.

We use Spring to decide whether to call the POJO implementation of a business bean or the EJB wrapped implementation of a business bean. This allows deployers to decide whether to deploy Liferay on a heavyweight application server like Borland ES (and thus leverage VisiBroker's transaction features) or a lightweight container like Tomcat.
Business bean建造於Spring上, 可以使用Spring的APO, IOC ...

Database Agnostic

Liferay uses Hibernate as the ORM tool for the persistence layer which enables pluggable databases (DB2, Firebird, Hypersonic, InterBase, JDataStore, MySQL, Oracle, PostgreSQL, SAP, SQL Server). This allows your organization to leverage existing resources without having to purchase new database hardware and software.

Scalable N-Tier Cluster

Liferay is very scalable and uses OSCache to provide deployers with a clustered cache. You can scale by adding more nodes without sacrificing on caching.

You can cluster the enterprise release of Liferay in multiple tiers: presentation tier, business logic tier, and database tier to meet your specific load requirements.

Struts and Tiles

Liferay leverages off of Struts to follow the MVC pattern. Most programmers are already familiar with Struts, which means your developers will have an easier time of writing portlets in a familiar framework.

The look and feel of the portal can be easily customized and reskinned because the display logic is concentrated in a few template files read by Tiles.
使用Struts以遵守MVC架構, Portal外觀非常容易客製化, 因為呈現的邏輯主要是由幾個template file負責的, 請參考Tiles.


Liferay can display and receive input in multiple languages. Language resources for Chinese, Dutch, English, French, German, Greek, Italian, Japanese, Korean, Portuguese, Spanish, Turkish, and Vietnamese are already included.


Portlets can be rearranged to the unique preferences of a user or community. Move things up, down, and all around.


Liferay allows administrators to easily manage users, groups, and roles through a GUI interface. Groups signify a collection of users. Roles signify permissions that a group or user can be bound to. Access to portlets are also restricted to users based on roles.

Administrators can also specify community pages so that all users who belong to a certain group see the same page.
可透過GUI介面輕易管理users, groups, roles. groups包含一組users, 而role則是設定group或user可存取的portlets.

Out of the Box Portlets

Liferay provides many useful portlets: Blogs, Calendar, Document Library, Journal (CMS), Image Gallery, Mail, Message Boards, Polls, RSS, and Wiki.

Portals are only useful so long as there are portlets that provide functionality. Our bundled portlets are a great starting point for a portal deployment. They also serve as a large code base of examples from which you can glean patterns on how to write portlets.
內含多個好用的portlets, 可作為portal deployment的好的開始, 也提供廣泛的範例程式碼, 讓你可收集如何製作portlet的模型.

Community Based Portlets

Many of the bundled portlets are community aware. For example, if you add an event to your HR community calendar, then Marketing would not be aware of it.




什麼是読み物? 就是讀物, 可以讀的東西.

現在社會閱讀主流是彼得杜拉克的管理著作, 但是管理主流卻是背道而馳, 小子我輩等怎可不努力求生存之道呢? 老闆的愛, 可都是"這要命的愛"啊 ...




這次大家再度相約"金色三麥", 其實是為了歡送米奇長老和文智.
米奇長老在這公司奮鬥12年, 現在要外出追求自己的創業路, 祝福他鵬程萬里...

長老的魅力無人能擋, 這次來了20多個, 還差點坐不下呢 ...
不過我還頭一遭碰到射飛鏢的時間比喝酒來的多的 ... 所幸長老得到第三名, 萬歲萬歲~~~

這卡片封面是Bunny精心繪製, 厲害喔...


長老長老真辛苦 犧牲奮鬥十二年

外出打仗跑第一 拼命努力達業績
客戶難纏身段軟 諸事纏身為哪樁
只求順利又平安 結案賺錢大家歡

培育英才不落人 廣開大門納建言
製作芋圓費心思 小火慢煮大家吃
產品技術求精進 團隊默契真正強

長老長老真正好 團隊裡面他最老
即將遠行創業去 一定成功拿第一


文智文智真正帥 青年才俊人人愛
遠渡重洋到台灣 幸福姻緣人稱讚
工作認真能力佳 老闆客戶皆欣賞
人緣魅力超閃亮 品行涵養一級棒
如今別離換跑道 依依不捨滿胸懷
祝福未來萬里路 一帆風順事事成

來來來, 歡送會開始囉

wow, 看Piggy吃東西的樣子, 很美味呢

噓...怡青正在思考卡片內容啦, 不要吵



趁老婆沒來台北... 拼命喝


這是金色三麥的二公升啤酒桶, 好像企鵝喔











我明天要拍婚紗, 今天不能喝啦


小毛致詞, 終於輪到小毛致詞贈獎給長老了




Bunny精心繪製, 猜猜看卡片信封的人物是誰...

人太多了, 要加桌子





小毛朗誦給長老的卡片, 居然大舌頭