Thursday, January 24, 2008

Wicket vs Struts : Head on Head

Mentioned below few of the prominant differences in Struts and Wicket framework

Feature

Struts

Wicket

Basic philosophy

Request-Response based MVC web application framework

Component based web application framework

Object orientation

Struts (even though has internally Object orientation) follows more procedure approach. Developers end up writing procedure codes in the actions.

Wicket follows a very strong object oriented component hierarchy similar to that of swing components

Presentation Layer Language

Needs JSP and at least a few decent taglibs (like jstl) for rending the view part

Wicket markup files are just pure HTML.

Separation of concerns

Presentation layer (being JSPs) is not possible for graphic designers to write independently.

Graphic designers can independently create the impressive presentation layer in pure (X)HTML.

Object Management

Struts is managed framework. [Developers do not have to create new instances of Action / Form etc. Struts provides developers the appropriate instances at the runtime based on xml configuration]

Wicket is unmanaged framework. [Developers would create needed component instances themselves]

Event and state management

In Struts, developer must handle each event fired on the screen. If there are 20 possible action happening on a page, developer would end up writing 20 action / if-else logic in single action class.

In Wicket, all the components know how to handle their own events. You would just need to add the components to Page class

Application Configuration

Struts need a complicated xml configuration file to initialize and maintain application configurration.

Wicket does not need any special configuration files. Application initialization is done by adding 4-6 lines in web.xml to declare a filter

No comments: