cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Bruchez <e...@bruchez.org>
Subject Re: cocoon & struts together
Date Thu, 06 Feb 2003 20:00:29 GMT
All,

There seems to be some confusion about Struts on this mailing-list. As
mentioned in one of the replies, Struts was designed to be an MVC
(Model/View/Controller) framework based on Model 2 (a hybrid
servlet/JSP architecture, as opposed to 100% servlet-based or 100%
jsp-based architectures).

This means that for each Web page, you write an action class (that
implements the MVC model) and a JSP page (that implements the MVC
view). The MVC controller is the configurable Struts controller, that
you usually leave alone. The model and the view can be modified
independently. If you define the interface between model and view
correctly, which comes down to defining what JavaBeans the model sends
to the JSP, you can achieve a very good separation of business logic
and presentation logic. This is what Struts was designed for!

About the business logic: using Struts has nothing to do at all with
whether you use EJB or not. You can implement your business logic
directly in Struts action classes if you want, or delegate to your
business logic components, including session EJBs. Struts, like
Cocoon, is mainly a presentation framework.

About the presentation logic: Struts provides tag libraries that make
it easier to write JSP pages (by the way, a lot of the concepts
present in those tag libraries have made it into JSTL, the JSP
Standard Tag Library, that makes much of the Struts tag libraries
obsolete). But the fact is that you don't have to use JSP with Struts,
you can use an XML-based presentation layer if you want. So yes, it
makes sense to use at least a subset of Cocoon with Struts. You may
want to leave dispatching, form handling, and the interaction with the
business logic to Struts, and use Cocoon to implement flexible XML
pipelines handling the look and feel, multiple device support,
etc. You can even use a combination of both JSP and XML pipelines if
you want. Have the JSP generate bare-bones HTML or XML, plug a Cocoon
generator to parse the JSP output, and off you go.

Why use Struts and Cocoon instead of using 100% Cocoon? Well, whether
you like it or not, many people and companies use Struts. Its feature
set is not too impressive, but the underlying architecture is
conceptually sound. It is often easier to sell to you manager the use
of Struts than the use of Cocoon. Also, you can incrementally add XML
processing to an existing application instead of starting from scratch
with Cocoon.

There is a JavaWorld article about how to combine Struts and XSLT that
you may find interesting:

   http://www.javaworld.com/javaworld/jw-02-2002/jw-0201-strutsxslt.html

A follow-up to this article will be published on TheServerSide.com
next week. The article even mentions Cocoon, in addition to our own
OXF!

-Erik

Juraj.Lenharcik@t-systems.com wrote:
 > Hi,
 >
 > has someone any experiences with the comosition of struts and cocoon?
 >
 > I have a middleware on EJB and JCA which connects to some Systems
 > like SAP. On this connects a webapplication which should be done
 > with with struts. Some areas of this application should be
 > transformed by cocoon in different outputs. My idea was to run some
 > views with cocoon. A struts action would connect a pipeline from
 > cocoon and passe the file which has to be transformed and
 > visualized.
 >
 > Any suggestions or practices?
 >
 > Juraj


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message