Tim Colson wrote:
>
> Scriptlets OK for "view" only?
>
> Another developer in my group and I discussed this at length last week. I
> believe scriptlets in the view to be "bad" practice...or at least a slippery
> slope towards badness. <grin>
>
> I suggest that there are two levels of separation we are trying to achieve.
>
> 1) Separation of Business Logic from Display logic
> 2) Separation of Developer tasks from Designer tasks
>
> I'd bet we all mostly agree and accept the first type as good MVC practice,
> and Struts does this quite well. The second type, though, would be violated
> by putting scriptlets into the View, something JSP does not prevent.
>
> While not violating MVC - the resulting View needs a Designer who knows
> Java.
>
> The counter-argument usually goes like so, "Well, there's JavaScript on the
> page, and the Designer understands that... and the JSP Scriptlet is Java
> which kinda looks like JavaScript...ergo, the Designer should be okay with
> that too."
>
> Slippery Slope. The Designer probably copied the JS from a Script archive,
> or used a WYSIWIG tool like DreamWeaver to build the script... ;-)
>
> BTW - the scriptlet was written because the existing taglibs either couldn't
> do what we needed, or at least it was taking too much time to figure out if
> they could. If we had Velocity as an option, I could have written the
> necessary bits without the complication of Java in short order. I'm not sure
> the Designer would understand it, but I'm betting I'd have an easier time
> explaining the minimal Velocity directives versus the Java <grin>
>
> Cheers,
> Tim Colson
Tim,
The current work in JSR-052 (JSP standard tag library -- JSPTL) is trying to
address some of these concerns.
Namely, our first Early Access release on jakarta-taglibs
(http://jakarta.apache.org/taglibs/doc/jsptl-doc/jsptl-ea1/index.html)
introduces control flow tags (<forEach>, <forTokens>, <if>, <choose>) as well as the
concept of a simple expression language (with associated tags
<expr>, <set>, <declare>) to simplify access to application data.
The JSR-052 expert group would be really interested in hearing from people
in the trenches. Please let us know if we are heading in the right
direction.
> If we had Velocity as an option, I could have written the
> necessary bits without the complication of Java in short order. I'm not sure
> the Designer would understand it, but I'm betting I'd have an easier time
> explaining the minimal Velocity directives versus the Java <grin>
In light of the current direction taken by JSPTL EA, could you tell us what
your web designers would think of JSPTL? What improvements would be required
to fit the bill?
Thanks,
-- Pierre