Hi folks,
In less than 10 days, (potential) customers asked "how does Cocoon
compare to Struts and JSP ?" This isn't the first time this question is
asked, but it's becoming more and more frequent. So in turn I ask you
this question, since my knowledge of Struts is limited to the docs at
the Jakarta site.
My impression is that Struts is targetted at web applications (opposed
to content publication) in HTML (no PDF, SVG, WML) and that Cocoon has
equivalent components (form validation stuff, actions, some XSP taglibs)
but can do much, much more.
The aim of this discussion not to start a Cocoon vs Struts flame, but to
build a document that will go into Cocoon docs to help us to promote
Cocoon when such questions arise.
The points to address are :
1 - how does Cocoon implement Struts features ?
2 - what does Struts do that Cocoon can't ?
3 - what does Cocoon do that Struts can't ?
4 - can we integrate Struts and Cocoon ?
5 - other items ?
Here's my view on these items :
1 - how does Cocoon implement Struts features ?
-----------------------------------------------
The main purpose of Struts is to provide a MVC framework in JSP. MVC is
about separating application concerns, which is something that is
naturally built in and enforced by Cocoon.
In Cocoon, the model is some presentation-independent XML produced by
generators from almost any kind of source (database, beans, EJB, xml
files, etc.), the view is defined by the transformation pipeline (XSL
stylsheets, I18N transformer, etc), and the controller is defined by
actions. Form validation and flow engine implement the equivalent
features in Struts.
Struts also offers internationalization features that are fullfilled by
Cocoon's I18N transformer and locale management.
2 - what does Struts do that Cocoon can't ?
-------------------------------------------
Mmmh... got an idea, someone ? ;)
3 - What does Cocoon do that Struts can't ?
-------------------------------------------
Struts in intrinsically limited to what can be done with JSPs, which is
producing text output such as HTML or WML. Moreover, it's JSP taglib is
very tied to HTML.
Cocoon, on the other hand, has a flexible serializer mechanism that
allows it to produce any kind of output such as (but not limited to)
PDF, JPEG, RTF.
The flow engine in Cocoon (in 2.1), by using a real programming language
and continuations (the ability to suspend a program), is far more
powerful than the action mapping definition in Struts.
Finally, Cocoon offers a very flexible and extensible framework that can
integrate almost anything, and comes with a lot of features that aren't
built into Struts. To name a few : browser selector, flexible form
validation, database manipulation actions and XSP taglibs (add other
important features here).
4 - Can we integrate Stuts and Cocoon ?
--------------------------------------
The JSP part of Struts can certainly be integrated into Cocoon using the
JSPGenerator. What about the controller part (i.e. the servlets) ?
Thanks for your input,
Sylvain
--
Sylvain Wallez
Anyware Technologies Apache Cocoon
http://www.anyware-tech.com mailto:sylvain@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
|