Comparing Web Frameworks: Struts, Spring MVC, WebWork, Tapestry & JSF

scarcehoseSoftware and s/w Development

Jul 14, 2012 (5 years and 4 months ago)

832 views

Comparing
W
eb Frame
w
orks:

Struts,
Spring MVC
,

W
ebW
ork,

T
a
pestr
y &

JSF
Matt Raible
www
.raibledesigns.com
!ww
.r
aibledesig
ns
.co"
Who is Matt Raible?

De
v
eloping w
ebsites since 1994 (bef
or
e Netsca
pe 1.0)

- De
v
eloping in J2EE w
eba
pps since 1999

Committer on se
v
eral open sour
ce pr
ojects:Roller

W
eblogger
,
XDoclet,
Struts Men
u,
Displa
y
T
ag,

AppFuse

J2EE 5.0 Exper
t Gr
oup Member

Author
:
Spring Liv
e (Sour
ceBeat) and contributor to

Pr
o JSP (Apr
ess)
!ww
.r
aibledesig
ns
.co"
!ww
.springlive
.co"
Frame
w
ork Experience

Struts:
used since J
une 2001 - same time 1.0 was

r
eleased.

Spring MVC:
used since Jan
uar
y 2004 - bef
or
e 1.0

was r
eleased.

W
ebW
ork:
used since J
ul
y 2004.

T
a
pestr
y:
used since J
ul
y 2004.

JSF:
used since J
ul
y 2004 - both Sun’
s RI and

MyFaces.
!ww
.r
aibledesig
ns
.co"
Meet the Candidates
!ww
.r
aibledesig
ns
.co"
Struts

Pr
os:

The
“Standar
d” - lots of Struts jobs

Lots of inf
ormation and examples

HTML tag librar
y is one of the best

Cons:

ActionF
orms - the
y’
r
e a pain

Can’
t unit test - StrutsT
estCase onl
y does integration

Mailing list v
olume is o
v
erwhelming
!ww
.r
aibledesig
ns
.co"
Spring MVC
!ww
.r
aibledesig
ns
.co"

Pr
os:

Lif
ecyle f
or o
v
er
riding binding,
validation,
etc
.

Integrates with man
y vie
w options seamlessl
y:
JSP/JSTL,

Tiles,

V
elocity
,
Fr
eeMark
er
,
Excel,
XSL,
PDF

In
v
ersion of Contr
ol mak
es it easy to test

Cons:

Not man
y using it

Requir
es writing lots of code in JSPs

Almost too fl
exible - no common par
ent Contr
oller
W
ebW
ork
!ww
.r
aibledesig
ns
.co"

Pr
os:

Simple ar
chitectur
e - easy to extend

T
ag Librar
y is easy to customize - back
ed b
y
V
elocity

Inter
ceptors ar
e pr
etty slick

Cons:

Documentation onl
y r
ecentl
y written,
f
e
w examples

Client-side validation immatur
e
T
a
pestr
y
!ww
.r
aibledesig
ns
.co"

Pr
os:

V
er
y pr
oductiv
e once y
ou learn it

T
emplates ar
e HTML - gr
eat f
or designers

Health
y and smar
t user comm
unity

Cons:

Documentation v
er
y conceptual,
rather than pragmatic

Steep learning cur
v
e - v
er
y f
e
w examples

Impossible to test - page classes ar
e abstract
JSF
!ww
.r
aibledesig
ns
.co"

Pr
os:

J2EE Standar
d - lots of demand and jobs

Fast and easy to de
v
elop with

Rich Na
vigation frame
w
ork

Cons:

T
ag soup f
or JSPs

Immatur
e technolog
y - doesn’
t come with e
v
er
ything

No single sour
ce f
or implementation
Contr
ollers and
Vie
ws

Struts:
UserAction extends DispatchAction

Spring MVC:
UserF
ormContr
oller extends

SimpleF
ormContr
oller

W
ebW
ork:
UserAction extends
ActionSuppor
t

T
a
pestr
y:
UserF
orm extends BasePage

JSF:
UserF
orm
!ww
.r
aibledesig
ns
.co"
List Scr
eens

Ho
w easy is it to integrate a sor
table/
pageable list of data?

Struts,
Spring MVC and
W
ebW
ork can all

use
T
ag Libraries lik
e the Displa
y
T
ag

T
a
pestr
y has a contrib:T
able component

JSF has a dataT
able with no sor
ting - ha
v
e

to write y
our o
wn logic if y
ou want it
!ww
.r
aibledesig
ns
.co"
Bookmarking and URLs

Using container
-managed authentication (or other fi
lter
-
based security systems) allo
w users to bookmark pages.

The
y can click the bookmark,
login and g
o dir
ectl
y to the

page
.

W
ebW
ork has namespaces - mak
es it easy

Struts and Spring allo
w full URL contr
ol

T
a
pestr
y has ugl
y URLs - diffi
cult to segment the a
pp f
or

diff
er
ent r
oles

JSF does a POST f
or e
v
er
ything
!ww
.r
aibledesig
ns
.co"
V
alidation

V
alidation should be easy to confi
gur
e
,
be r
obust on the

client side and either pr
o
vide g
ood out of the bo
x messages

or allo
w y
ou to easil
y customize them.

Struts and Spring MVC use Commons
V
alidator - a

matur
e solution

W
ebW
ork uses OGNL f
or po
w
erful expr
essions -

client-side suppor
t v
er
y ne
w

T
a
pestr
y has v
er
y r
obust validation - g
ood messages

without need to customize

JSF - ugl
y default messages,
but easiest to confi
gur
e
!ww
.r
aibledesig
ns
.co"
T
estability

Struts - can use StrutsT
estCase

Spring and
W
ebW
ork allo
w easy testing with

mocks (i.e
.
EasyMock,
jMock,
Spring Mocks)

T
a
pestr
y is impossible to test because page classes

ar
e abstract

JSF page classes can be easil
y tested and actuall
y

look a lot lik
e
W
ebW
ork actions
!ww
.r
aibledesig
ns
.co"
Success Messages

The duplicate-post pr
oblem,
what is it?

Easiest wa
y to solv
e:
r
edir
ect after POST

Struts is the onl
y frame
w
ork that allo
ws success

messages to liv
e thr
ough a r
edir
ect

Spring and
W
ebW
ork r
equir
e custom solutions

T
a
pestr
y r
equir
es y
ou to thr
o
w an Exception to r
edir
ect

JSF r
equir
es a custom solution,
i18n messages diffi
cult to

get in page beans
!ww
.r
aibledesig
ns
.co"
Spring Integration

All frame
w
orks ha
v
e integration with Spring

Struts:
ContextLoaderPlugin and Base classes

W
ebW
ork:
SpringObjectFactor
y

T
a
pestr
y:
o
v
er
ride base engine
,
grab fr
om ser
vlet

context,
put into global ma
p

JSF:
DelegateV
ariableResolv
er or JSF-Spring Librar
y
!ww
.r
aibledesig
ns
.co"
Internationalization

JSTL

s fmt:message tag mak
es it easy

No standar
d f
or getting i18n messages in

contr
oller classes

Struts,
Spring and JSF encourage one

Resour
ceBundle per locale

W
ebW
ork and
T
a
pestr
y adv
ocate separate


les f
or each page/action
!ww
.r
aibledesig
ns
.co"
Page Decoration

Used
Tiles since it fi
rst came out in 2001

SiteMesh is m
uch easier to setup and use

Tiles can be used in Struts,
Spring and JSF

Requir
es confi
guration f
or each page

SiteMesh can be used with all frame
w
orks

Requir
es v
er
y little maintenance after

setup
!ww
.r
aibledesig
ns
.co"
T
ools

Struts has a lot of IDE suppor
t and e
v
en has

frame
w
orks built on top of it (i.e
.
Beehiv
e’
s

PageFlo
w)

Spring has Spring IDE - onl
y does XML validation,

not a UI/w
eb tool

W
ebW
ork has none

T
a
pestr
y has Spindle - gr
eat f
or coders

JSF has man
y
,
all cost mone
y and hook into

pr
oprietar
y a
pp ser
v
ers
!ww
.r
aibledesig
ns
.co"
Business/Mark
eting

Struts is still in high-demand and widel
y-used

Spring is getting mor
e pr
ess,
but mostl
y due to the

frame
w
ork’
s other f
eatur
es

W
ebW
ork is gaining gr
ound,
but pr
etty scar
ce on

job boar
ds

T
a
pestr
y is e
v
en mor
e scar
ce - needs mor
e

mark
eting

JSF is quickl
y becoming popular
!ww
.r
aibledesig
ns
.co"
Dice J
ob Count
October 15,
2004
0
375
750
1,125
1,500
Struts
Spring Frame
w
ork
W
ebW
ork
T
a
pestr
y
JSF
!ww
.r
aibledesig
ns
.co"
My Opinion

Struts is fast to de
v
elop with because most pr
oblems ha
v
e

been solv
ed.
HTML tag librar
y the best of the bunch.


Spring is nice
,
but lack of f
orm tags dr
ops it do
wn a notch

or tw
o
.
JSP 2.0 tag fi
les exist in issue track
er
.

I lik
e
W
ebW
ork a lot,
but lack of of g
ood client-side

validation suppor
t is a killer
.

T
a
pestr
y - I ha
v
en’
t fi
nished the learning cur
v
e
.

JSF - needs to listen to de
v
elopers to see what the
y want

instead of tools v
endors.
!ww
.r
aibledesig
ns
.co"
Which w
ould I choose?

Quick and dir
ty pr
oject?

Struts
because I kno
w it best

Massiv
e enterprise pr
oject?

T
a
pestr
y
f
or its r
eusable components

If I g
ot a job as an open sour
ce de
v
eloper?

W
ebW
ork
because using it r
equir
es y
ou

to dig into the frame
w
orks
!ww
.r
aibledesig
ns
.co"
Resour
ces

Do
wnload sample a
pps f
or this pr
esentation

http://equino
x.de
v
.ja
va.net/frame
w
ork-comparison

Struts -
http://struts.a
pache
.org

StrutsT
estCase:

http://strutstestcase
.sf.net

Spring MVC -
http://www
.springframe
w
ork.org

Spring IDE:

http://www
.springframe
w
ork.org/spring-ide/eclipse

W
ebW
ork -
http://opensymphon
y
.org/w
ebw
ork

Eclipse Plugin:
http://sf.net/pr
ojects/eclipse
w
ork

IDEA Plugin:
http://wiki.opensymphon
y
.com/displa
y/WW/IDEAPlugin
!ww
.r
aibledesig
ns
.co"
Resour
ces,
cont.

T
a
pestr
y -
http://jakar
ta.a
pache
.org/ta
pestr
y

Spindle:
http://spindle
.sour
cef
orge
.net

JSF -
http://ja
va.sun.com/j2ee/ja
vaser
v
erfaces
and
http://
m
yfaces.org

Ja
va Studio Cr
eator
:
http://sun.com/softwar
e/pr
oducts/jscr
eator

MyEclipse:
http://m
y
eclipseide
.com

IDEA:

http://www
.jetbrains.com/idea

SiteMesh:

http://opensymphon
y
.com/sitemesh
!ww
.r
aibledesig
ns
.co"
Resour
ces,
cont.

T
esting Frame
w
orks

JUnit:
http://junit.org

EasyMock:
http://easymock.org

jMock:
http://jmock.org

jW
ebUnit:
http://jw
ebunit.sour
cef
orge
.net

Canoo
W
ebT
est:
http://w
ebtest.canoo
.com

XDoclet -
http://xdoclet.sour
cef
orge
.net

AppFuse -
http://a
ppfuse
.de
v
.ja
va.net
!ww
.r
aibledesig
ns
.co"
Books

Struts in
Action,

T
ed Husted and
T
eam

Struts Liv
e
,
Rick Highto
w
er and J
onathan Lehr

Spring Liv
e
,
Matt Raible

Spring in
Action,
Craig
W
alls and Ryan Br
eidenbach

Pr
of
essional Ja
va De
v
elopment with Spring,
Rod

J
ohnson,
J
uergen Hoeller and
T
eam
Books,
cont.

W
ebW
ork in
Action,
Patrick Lightbody and
T
eam

T
a
pestr
y in
Action,
Ho
war
d Le
wis Ship

Cor
e JSF
,
Da
vid Gear
y and Ca
y Horstmann

JSF in
Action,
Kito Mann
The End
...or is it just the beginning...
!ww
.r
aibledesig
ns
.co"