By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,568 Members | 1,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,568 IT Pros & Developers. It's quick & easy.

improving JSP logic

P: n/a
If I'm in the rwong newsgroup, please point me where to post

I'm plunging into the world of JSP development and I'm
wanting to improve on this type of [messy] logic:

<% int rowCount = 0; %>
<logic:iterate id="oi" name="myForm" property="stuff">
<% if (++rowCount % 2 == 0) { %>
<tr class=normalRow>
<% } else { %>
<tr class=altRow>
<% } %>
<td><bean:write name="oi" property="group3Name" /></td>
</tr>
</logic:iterate>

My attempts have been various incarnations (for the <tr>) of the
following, utilizing iterate's -indexId-:

<logic:notEmpty name="myForm" property="stuff">
<logic:iterate id="oi" name="myForm" property="stuff" indexId="index">
<tr class=<% (index.intValue()%2==0) ? "altRow" : "normalRow"; %>" >
<td><bean:write name="oi" property="group3Name" /></td>
</tr>
</logic:iterate>

Unfortunately, we arent using JSTL (and wont be), otherwise I
could use this fix:
http://cephas.net/blog/2004/02/25/js...ts_taglib.html

Any suggestions for improvement ?

Oct 7 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

LinuxTester wrote:
If I'm in the rwong newsgroup, please point me where to post

I'm plunging into the world of JSP development and I'm
wanting to improve on this type of [messy] logic:


This was all server-side Java Server Pages.
You posted this in a client-side javascript group.

Try comp.lang.java groups thataway ==>

Oct 10 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.