Here's my two cents:

This is an example without Struts:

<%
  List list = dvds.getDVDList();
  for (Iterator i = list.iterator(); i.hasNext();) {
    DVD dvd = (DVD)i.next();
%>
  <tr>
    <td><%=dvd.getTitle()%></td>
    <td><%=dvd.getLength()%></td>
    <td><%=dvd.getActors()%></td>
  </tr>
<%
  }
%>  

This is the same example with Struts:

<logic:iterate id="dvd" name="dvds" property="DVDList">
  <tr>
    <td><bean:write name="dvd" property="title" /></td>
    <td><bean:write name="dvd" property="length" /></td>
    <td><bean:write name="dvd" property="actors" /></td>
  </tr>
</logic:iterate>

The argument for struts is that this is "cleaner".  I guess that's
because it all has nice <tag> and </tag> symmetry.

Personally, I don't much see it being cleaner.  I understand the upper
code better than the lower.  And the lower syntax is very confining,
especially if my classes don't exactly conform to the JavaBean
specification - let's say one of my methods was "calculateTax".  Unless
I change that method name to "getTax", I will not be able to create a
<bean:write> tag for it.  Also, my object of type "dvds" has to be of a
specific interface - one that supports the "iterator" method.

I suggest taking a LOT of time to read the Struts tag library to make
sure you realize what you're getting yourself into.  Struts is fine if
you like having your language dictate how you write your application.
Me, I'll stick with my own code.

Joe


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.