struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Husted <hus...@apache.org>
Subject Re: Barracuda vs. Struts
Date Tue, 28 Aug 2001 20:20:11 GMT
Christian Cryder wrote:
> a. Would it be acceptable to change the description to "Action Mappings
> (struts-config.xml)"? I wanted to convey the idea that the mappings were
> specified declaratively.

Sure. 

> b. Could you explain what you mean by "These are accessed by the Controller
> and the View via tags."? I'm assuming you are NOT saying that the Controller
> accesses them via tags. But I'm unclear how the View accesses the
> ActionMapping stuff...doesn't the view just grab data from a) ActionForms or
> b) beans which are set up by the Action classes?

The Controller servlet uses the Digester to create a ActionMappings
object in the ServletContext. The tags know the name of the
ActionMappings object and access it that way.

Struts is model-neutral, and none of the Struts tags are designed to
access the model. Though, developers could use such tags of their own
(which I know annoys you, Jon Stevens, and several other observers ;-).

I personally believe a distinction between the Model and the model
will be lost on nearly everyone. The Struts tags are designed to expose
JavaBeans, which may from the model or some other state. It's my opinion
that a central feature of Model 2 should be that the model is
displayed by the view ~through~ the controller. The Struts tags do not
interact with the model but only with the controller.

> I'm afraid I don't follow this at all. The point I am attempting to make in
> #2 is that even if developers don't use scriptlets, the use of tag-libs (at
> least if you use conditionals or iterative tags) effectively mixes
> "programming logic" in with your markup. While I have heard this justified
> by calling it "presentation logic" (thereby it's ok to mix it in), in my
> mind its not compelling--the tags logic is evaluated and processed on the
> server, the markup on the client. To me this breaks the clean separation
> (and as such its a valid criticm).

Sorry, I thought you meant the 

<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

markup that specifies the library to be included.

> Hmmm...I think we have a different definition of "valid markup". For me,
> valid markup is HTML or XML that can be validated by a DTD. Templates which
> remain "valid markup" in this sense of the word can be easily manipulated by
> any standard markup tool (Dreamweaver, FrontPage, etc).

Custom taglibs can be validated via the TLDs. A GUI that reads TLDs can
validate the custom tags (and generate dialogs for them) along with any
other 
markup.

> Actually, Barracuda templates remain valid markup at all times since all
> they use is id or class attributes (validated by the HTML 4.01 strict.dtd).
> For XML, WML, etc. you can specify an attribute name (ie. if 'id' or 'class'
> is not a valid attribute).

I stand corrected then. Quite clever really.

> I would be interested in hearing more about how this actually works. What
> I'm especially interested in is how the Action classes would specify the
> View...in other words, my conception of "Skins" is that the Controller code
> says "render this view" and has no knowledge of what skin actually gets
> used. In other words, the skins logic ("for this view use this skin") should
> be decoupled from the application logic ("for this action generate this
> view"). I'd love to hear how you guys handle this.

Cedric's Tiles package uses a XML configuration file that can specify
various template settings, and can be passed along in the request. I'll
be 
doing some more work with these myself this week. 

http://www.lifl.fr/~dumoulin/tiles/

> I'd actually like to take some time and benchmark this...Would you be
> willing to help me develop a set of criteria that might correspond to a
> typical Struts application (ie. how many reflection calls actually get made
> for a typical page). Maybe we could even put together a very simple app (ie.
> one screen that pulls data from a statically defined JavaBean) in both
> Barracuda and Struts just to see how they compare. I'd be very interested in
> trying to quantify just how much of a hit there is 

My Struts-Simple app might work for this. 

http://husted.com/about/struts/resources.htm#new

Meanwhile, I'm still not sure why you slot Struts for "Page Author"
types. Because it uses JSPs? After all, you said yourself that
developers end up writing JSPs, so that can't be it ;-) 

A Model 1 JSP framework might be targeted for "Page Author" types, but
Struts is a Model 2 framework. Servlet smart, page dumb.

Now, DreamWeaver UltraDev, that's a platform for Page Author types that
want to use JSP. (It's actually quite impressive -- if you never look at
the
code it generates ;-)


-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/about/struts/

Mime
View raw message