1. Action based framework
2. Mature with a vibrant develpoer and user community
3. pojos based actions that are ez to test
4. Annotation and XML configuration options
5. Spring , SiteMesh and Tiles integration
6. OGNL expression language integeration
7. Themes based tag libs and ajax tags
8. Multi-View options ( jsp , freemarker , Velocity and XSLT)
9. Plugins to extend and modify framework features
使用JSP 以及 Scriptlet 開發的時代已經過去了!
在以前的工作經驗中,由於從jsp 1.1開始接手,使用相當多的scriptlet,
導致程式維護上很難處理,該是慎選好一個framework,並且實際去將scriptlet 拿掉的時候了!
Q:何為Action-Based Frameworks ?
A:
主要想法是希望能將request處理過程根顯示邏輯層切開來。讓每個部份都能只處理到該所擔任的腳色
而有名的實作就是mvc pattern的架構了!
在mvc pattern中, servlet 就是指controller,提供了一個集中管理的控制.
將url的對應到一個實際的運作單元( a unit of work know as an action).
那麼這個action的工作就是去處理送過來的需求,然後將response對應到一個 pojos model.
最後 action 將會回傳一個result, 去對應到一個 jsp (也就是指的view了)
*** Struts2 is an action based MVC web framework ***
Q: 何為 Component-Based Frameworks
A:
在web app這塊領域上現在可說是越來越複雜了,我們可以意識到的是一個頁面
不再只是邏輯顯示層,一個頁面可以放多個form,甚至是其他自訂的資訊,當然
每一個task都會需要該處理邏輯的功能。
一個html tag都可以稱做是一個元件!
而每個元件都有其對應的event可以處理(有listener來幫忙)
CBF的一個優點是可以讓你設計得元件跨不同的webapp做re-use,著名的CBF有JSF, Wicket,Tapestry
AJAX :
In effect, an Ajax user interface calling an action based framework
allows the action framework to behave in a similar manner to a component based framework.
In fact, this combination of technologies provides a more loosely-coupled and more re-usable system.
The same actions can provide JSON, XML or HTML fragment views for the Ajax
components as well as being combined with other actions to provide HTML views for non-Ajax user interfaces.
沒有留言:
張貼留言