Craig McClanahan wrote:
(1) Scriptlets, since they are Java code, require someone at least passably familiar with Java to change them later. If you have folks that are primarily page authors, you are faced with a cost of teaching them enough about Java syntax to make the code it needs to do, or having to involve two folks in every page (a page author and a Java developer), or paying Java developers to maintain HTML. None of those approaches is appealing to me.
In my personal opinion, a lot of these presentation layer technologies can be more challenging to master than Java. For instance, I consider myself to be proficient in Java, buy my CSS skills suck ass (pardon my English). For others, their CSS is good, but their Java, eh, not so good. Time invested in the particular technologies may explain the discrepancies, still the strength of JSP Custom Tags comes into play: they are a tool for collaboration among developers.
(2) Scriptlets, since they are Java code, bind you to a particular representation of your data to a much higher degree than scripting expressions do. Take your favorite Struts action form, and implement it first as a DynaBean (because it's faster to prototype that way), and use tags like <html:text> when building your input forms. Now, lets say a requirement changes such that you have to do some specialized work when a form bean property is set or retrieved, such that you need to switch to a regular ActionForm implementation instead. If you used the Struts tags, how much did you have to change the JSP source? None -- the "name" and "property" expressions work with either dynabean action forms or POJO ones. On the other hand, if you used scriptlet expressions, you'd have to change every single one of them.
I don't think this is necessarily true. You could design your scriplets to display from POJB (plain old JavaBeans(tm)) or dynabeans.
(3) The custom tags do more for you than just set and retrieve data. Here's just a couple of examples where using the tag gets you extra
benefits for free:
* In order for sessions to work on browsers with cookies disabled, you have to call an extra method to encode them. <html:link> does it for you ... a dynamic scriptlet call does not.
This could be done with a scriptlet. Something like:
<%= getLink("link display", "link name", request) %>
Still, <html:link> is preferred.
None of this is to say that you can't be productive when using scriptlets. But my experience has been that whatever boost they give you tends to be short term; over the long run, you're generally better off desigining for minimum maintenance, rather than designing for minimum initial development.
Quality scriptlet libraries are not exactly pervasive. Anyway, the tags add an air of consistency to JSPs. I'm of the opinion that style is important.
- Dave
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]