On Wed, 9 May 2001, Taylor Cowan wrote:

> I don't know a lot about Cocoon, but I believe it is similar to Struts in
> that it has a "master" servlet which is awakened by requests matching a
> particular expression.  In that sense they are mutually exclusive.
> Sometimes I'm tempted to consider the benefits of combining the two but I
> always end up realizing its not an improvement.  For example, if you want
> some view feature of struts, it would be better to do it in XSL with Cocoon,
> not combining the two.
> 
> One way I can see a combination is where the app is basically struts, but an
> include page (either through frames, templates, jsp:include or @ include )
> is sourced from Cocoon.  Basically a portal with a window into Cocoon, since
> iteraction with Cocoon is just a URL.  But still the two frameworks act
> independently.
> 

Another opportunity for integration is a recently added Struts feature
-- you can now implement an Action as a separate servlet (or JSP page),
accessed via RequestDispatcher.forward(), using the new standard
ForwardAction:

  <action path="/mypath"
          type="org.apache.struts.actions.ForwardAction"
     parameter="/path/to/processing/servlet"
  />

You still get the ability to use Struts's form bean population and
validation (if desired), but it's now possible to integrate with a servlet
or JSP page (or a Cocoon request) that implements the Action logic itself.

One interesting thing I've been experimenting with (using this
technology) is "scripting" the Action as a JSP page, using the same Struts
bean and logic tags we know and love for user presentation, coupled with
things like the "dbtags" library in the Jakarta Taglibs project
<http://jakarta.apache.org/taglibs>.  The business logic page you build
for this would not do any output of its own -- it would use <jsp:forward>
(or equivalent) to forward to a page that actually does the presentation
-- but this opens the opportunity for non-Java programmers to still be
able to create "actions" that plug into the Struts framework.



> Taylor

Craig

PS:  I *thought* I had checked ForwardAction and IncludeAction in quite a
while ago -- but they weren't in the CVS repository.  They are now.

Reply via email to