Struts Tags, JSP Custom Tags, and Java Scriptlets: What s the Right Balance?


Struts Tags, JSP Custom Tags, and Java Scriptlets: What's the Right Balance?

It's probably appropriate to mention up front that you can use Struts without using any of the Struts custom tags. If you want to, you can develop straight JSP files and still use the MVC architecture, Action classes, and most of the rest of the framework. We don't recommend it, but it's possible.

It's common to wonder whether you can use Struts tags and completely avoid the use of any Java scripting. This, too, is possible, but it requires a great deal of effort.

The scripting capability of JSP and Struts is very limited if you don't use Java scriptlets. You can develop JSP custom tags that hide the scripting, but sometimes doing so is overkill.

This changed a great deal with the latest versions of JSP and the introduction of JSTL. It'll be improved even more when the upcoming specifications for Java ServerFaces are released and application servers provide support for it.

Note

For more information about Java Server Faces, please refer to its specification, which is located at http://jcp.org/jsr/detail/127.jsp.


For now, we recommend that you do your best to eliminate Java scriptlets, but advise you not to take a hard line against them. What you'll likely find is that on every project there are a few places where Java scriptlets can save you a lot of time. Just don't overuse them or you'll run into the maintenance problems that caused people to try to avoid their use to begin with.



Struts Kick Start
Struts Kick Start
ISBN: 0672324725
EAN: 2147483647
Year: 2002
Pages: 177

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net