DEVFYI - Developer Resource - FYI

Why do the Struts tags provide for so little formatting?

Struts Questions and Answers


(Continued from previous question...)

51. Why do the Struts tags provide for so little formatting?

The Struts tags seem to provide only the most rudimentary functionality. Why is there not better support for date formatting and advanced string handling?
Three reasons:
First, work started on the JSTL and we didn't want to duplicate the effort.
Second, work started on Java Server Faces, and we didn't want to duplicate that effort either.
Third, in a Model 2 application, most of the formatting can be handled in the ActionForms (or in the business tier), so all the tag has to do is spit out a string. This leads to better reuse since the same "how to format" code does not need to be repeated in every instance. You can "say it once" in a JavaBean and be done with it. Why don't the Struts taglibs offer more layout options?
Since the Struts tags are open source, you can extend them to provide whatever additional formatting you may need. If you are interested in a pre-written taglib that offers more layout options, see the struts-layout taglib.
In the same arena, there is a well regarded contributor taglib that can help you create Menus for your Struts applications.

(Continued on next question...)

Other Interview Questions