You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ju...@t-systems.com on 2003/02/03 16:45:45 UTC

cocoon & struts together

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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: cocoon & struts together

Posted by Upayavira <uv...@upaya.co.uk>.
> http://jakarta.apache.org/taglibs/doc/io-doc/index.html). It seems to work
> quite well for our needs, but it would be nice to be able to call the cocoon
> pipelines programmatically.

Check out the CocoonBean, recently added to the dev version 2.1 in CVS 
(org.apache.cocoon.bean.CocoonBean). It allows you to have cocoon generate a 
page or pages and save them to disc (or send them to any 'Destination'). 
Alternatively, you can write the content for a specific page to an output stream. 
Looking at the code, the latter functionality looks broken to me at the moment - I'll 
give it a go now. If you want to use this, let me know and I may be able to send 
you a patch.

Regards, Upayavira


---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: cocoon & struts together

Posted by Erik Bruchez <er...@bruchez.org>.
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: cocoon & struts together

Posted by Richard Bounds <ri...@richardbounds.co.uk>.
We're working on a similar setup - Struts-based form logic, with views of
the data processed by cocoon into html/pdf/excel. Currently we simply pull
html cocoon content into jsp's with an http request (using:
http://jakarta.apache.org/taglibs/doc/io-doc/index.html). It seems to work
quite well for our needs, but it would be nice to be able to call the cocoon
pipelines programmatically.

Richard

-----Original Message-----
From: Juraj.Lenharcik@t-systems.com
[mailto:Juraj.Lenharcik@t-systems.com]
Sent: 03 February 2003 15:46
To: cocoon-users@xml.apache.org
Subject: cocoon & struts together


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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>




---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: cocoon & struts together

Posted by Matthew Langham <ml...@s-und-n.de>.
Hi Juraj,

> like SAP. On this connects a webapplication which should be done
> with with struts. Some areas of this application should be

why are you considering Struts (at all)? I am interested in this as we often
meet this kind of setup/discussion and we try to convince people to go for a
Cocoon-only solution (of course) :-)

Matthew

--
Open Source Group       Cocoon { Consulting, Training, Projects }
=================================================================
Matthew Langham, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
Tel:+49-5251-1581-30  mlangham@s-und-n.de - http://www.s-und-n.de
-----------------------------------------------------------------
Cocoon book:
  http://www.amazon.com/exec/obidos/ASIN/0735712352/needacake-20
Weblogs:
  http://radio.weblogs.com/0103021/
  http://www.oreillynet.com/weblogs/author/1014
=================================================================


> -----Original Message-----
> From: Juraj.Lenharcik@t-systems.com
> [mailto:Juraj.Lenharcik@t-systems.com]
> Sent: Monday, February 03, 2003 4:46 PM
> To: cocoon-users@xml.apache.org
> Subject: cocoon & struts together
>
>
> 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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>


---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>