开发者

How can I get input side by side in JSP

<table>
<c:forEach items="${requestScope['rfpq.mailRecievers']}" var="row">
<tr>
                                            <td>&nbsp; </td>
<td style="color: #000000; font-size: 11px;" height="17" width="450">  &nbsp;${row} |</td> 

</tr>
</c:forEach>
</table>

Input is:

A0001 |

A0002 |

A0003 |

A0004 |

A0005 |

How will I get input like(with colors):

A0001 开发者_开发百科| (color: gray) A0002 | A0003 | (color: gray) A0004


<table>
    <tr>
        <c:forEach items="${requestScope['rfpq.mailRecievers']}" var="row" varStatus="status"  >
            <c:choose>
                <c:when test="${status.count%2==0}">
                    <td style="color: #000000; font-size: 11px;" height="17">   &nbsp;${row} |</td> 
                </c:when>
                <c:otherwise>
                    <td style="color: gray; font-size: 11px;" height="17">   &nbsp;${row}|</td> 
                 </c:otherwise>
             </c:choose>
        </c:forEach>
    </tr>
</table>

You can use the varStatus attribute to access the LoopTagStatus instance for the current <c:forEach>, and its count property gives you the loop counter. The you can use this loop counter to style your odd column and even column.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜