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








Reply via email to