struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Axel Stahlhut <astahl...@neusta.de>
Subject Re: How can I display a table in two columns?
Date Tue, 06 Apr 2004 17:49:36 GMT
bOOyah wrote:

> Hi all
>
> I have a 2-column table containing 16 row items, each with an 
> associated checkbox.  Right now I'm iterating over a List to render 
> each row of the table.  Column 1 contains the checkboxes; column 2 
> contains the items.
>
> So my table currently looks like this (x == a checkbox):
>
>     x item-1
>     x item-2
>     . . .
>     x item-16
>
>
> Is there a straightforward way to iterate my List so as to render my 
> table as two columns (four columns really) of 8 rows each?   Like this:
>
>     x item-1    x item-9
>     x item-2    x item-10
>     . . .       . . .
>     x item-8    x item-16
>
>
> Thanks!

Hi.

There are a lot of ways to reach what you need, but the following is the 
nicest, I think:

<table>
<logic:iterate: name="myBean" property="listProperty" index="id">
<tr><td>
    <html:checkbox name="..." value="<%=whateverValue%>"/>
</td><td>
    <html:checkbox name="..." value ="<%=whateverValue+8%>" />
</td></tr>
</logic:iterate>
<table>

|If the length of the list is dynamic, you have to first calculate the half and the offset
to add etc. Furthermore you would then have tot 

Regards Axel
|


By the way, what is the submitted value of the cb? Is it the index or 
some other kind of id?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message