[Mav-user] RE: Re: One More Thing, Please

2002-06-15 Thread Jeff Schnitzer

[list:  we're moving this onto mav-user for obvious reasons :-)
Included below is a brief comparison of Maverick to Struts  WebWork]

 From: Anthony W. Marino [mailto:[EMAIL PROTECTED]]
 
 Hi Jeff,
 What do you think of the Struts opensource layer stxx (
 http://www.openroad.ca/opencode/ )?  How does this compare with
Maverick's
 xml/xsl functionality?

Meagerly :-)  It looks like a crude first pass at providing the
facilities that Maverick supports.  Things missing from stxx that
Maverick supports:

. Multiple transformations.  Not only does Maverick offer multiple
transforms, but you can go between XML-based and text-based
transformations seamlessly.
. SAX input.  Stxx only takes a (DOM or JDOM) Document as input.
Maverick transforms can take text, DOM, or (most importantly) SAX as
input.  And XML-based transforms are hooked together with SAX events.
Much more efficient than passing DOM trees around.
. View independence.  Using XSL with Maverick is no different,
Java-wise, than using any other view.  Our primary sample application
comes in three flavors; JSP (with JSTL), Velocity, and XSL.  They all
use the same Controllers (Struts calls them Actions), so you can easily
switch view technology method-by-method.  With Stxx, your Actions have
to be extend ActionStxx and call a number of special methods.
. Automatic domification.  Maverick will automatically convert your
JavaBean model to a form that can be operated on by XSL; Stxx expects
you to come up with a Document yourself (another reason their Actions
are not view-independant.  You could use our code
(http://domify.sourceforge.net) with Stxx, but you'd have to set it up
yourself.

Struts was not designed from the beginning to provide transformation
pipelines, so retrofitting the architecture is problematic.

Jeff Schnitzer
[EMAIL PROTECTED]

For the list's benefit, the original conversation:

  I'm not very familiar with Tapestry, but all the others I have used
  fairly extensively:
 
  Velocity - this is not a competing framework but a templating
language
  that works exceedingly well with Maverick.  Personally, this is my
  favorite way to write web applications, although Maverick lets you
use
  JSP, XSL, DVSL, or conceivably any other templating language as well
  (it's pluggable).
 
  Regarding WW and Struts, I'll go over it by topic:
 
  Templating technology independence
  --
  WW and Struts have traditionally been tied to JSP, relying on custom
tag
  libraries for data access.  They're trying to claw their way out of
this
  situation, but it's rough.  WW, for example relies on an exotic
concept
  called the ValueStack which does not map well onto anything other
than
  their tags.  You have to fight the system to use JSTL with WebWork.
 
  Maverick was templating language independent from the beginning, and
I'm
  pretty sure that most Maverick users are using something other than
JSP.
  We don't provide a custom tag library because the JSTL standard tag
  library works great with Maverick, if JSP is your taste.
 
  For both WW and Struts, rendering a view is simply a question of
  RequestDispatcher.forward()ing to a named document, be that
blah.jsp,
  blah.vm, or blah.xsl.  This works ok (but not great) for jsp and
  velocity, but is hopelessly inadequate for XSL.  How do you set
params?
  What if you want multiple transformations?  How do you set custom
URI
  resolvers?  Maverick handles all of this elegantly in the sitemap
file,
  where it belongs.
 
  And we really mean templating language independent.  We provide
three
  different versions of one of our sample applications; a JSP version,
a
  Velocity version, and an XSL version.  The java code (Controllers)
are
  unchanged for each - only the templates and the Maverick config file
  change.
 
  Transformation
  --
  The most dramatic feature that Maverick offers that WW and Struts
have
  not even considered is the ability to hook up Cocoon-style pipelines
of
  transformation to view rendering.  Out of the box, Maverick can do
stuff
  like this:
 
Render the model to XML with a JSP
Transform the XML with a common look-and-feel with XSL
Convert to Formatting Objects with XSL
Render the document to PDF with Apache FOP
 
  And you can even eliminate the rendering of XML with JSP by using a
  special view type called domify which automagically adapts a
JavaBean
  graph to a DOM interface so that XSL (or DVSL) can be applied to it
  directly.
 
  Transformations do not have to be XML-based, they can be simple text
  transformations like wrapping the output of a previous step with
another
  template (providing the data as a String in the context).  This is
  really useful for basic look-and-feel templating in a JSP or
Velocity
  world.  You could easily build a regex text substitution
transformation
  if you wanted to.
 
  Oh, another neat thing is that you can stop the transformation
process
  midstream to obtain intermediate output.  

[Mav-user] RE: Struts/Maverick

2002-06-15 Thread Jeff Schnitzer

 From: Anthony W. Marino [mailto:[EMAIL PROTECTED]]
 
 I found some emails with you and Husted discussing the potential of
 merging
 with Struts  (

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg22749.html
).
 Do you see that as a potentially happening ???  Would that be much
 different
 than the Struts/stxx layering???

It would be dramatically different than the Struts/stxx layering, which
is very limited and does not offer orthogonality with other view types.

I'll keep poking every now and then.  I would be happy to contribute the
Maverick code (with integration, of course) as Struts 2.0 and continue
working on it there.  That may sound arrogant given that we are a small
community and they are a large one, but at this point I think Maverick
is pretty close to a 100% superset of Struts features, and we offer a
*lot* more.  That said, I doubt Maverick-as-Struts-2.0 will ever happen,
simply because of Not Invented Here.

There is a small chance that they might become interested as they bump
into the limits of the existing Struts architecture, but it'll be a hard
sell.  I'm not myself an Apache committer, although I'm moderately
active in some of the communities.  I know some of the Jakarta people
personally, but none of the Struts folk.  Other than trolling on their
mailing lists, I don't have any inroads.

The first thing that would have to happen to at least make the sell
reasonable is that I (or someone) would have to write a Struts
integration layer.  This would be a ControllerSingleton base class that
*exactly* mimics the Struts Action API.  When Struts applications run
without recompilation on Maverick, that might raise some eyebrows.

There is the issue of the Struts tag library, but I think that will go
away as JSTL replaces it.  I consider the Struts tags more or less
already to be obsolete.  On the other hand, it's very possible to write
a Maverick ViewFactory that builds Struts views...

Maybe there is a week of work here, but since I don't need it myself,
and nobody has asked for it, it hasn't been done.

I suppose the other question is - if it were possible to merge Struts
and Maverick, would the existing Maverick community want this?  There is
a risk that trying to integrate with Struts could produce something that
is definitely not Maverick; there is a little bit of an everything
including the kitchen sink attitude in that community.  The fact that
they have database connection pooling code in the framework is
bewildering.  Why on earth...

Jeff Schnitzer
[EMAIL PROTECTED]

___

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - 
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

___
Mav-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mav-user
Archives are available at http://www.mail-archive.com/