struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Perry" <d.pe...@netcase.co.uk>
Subject RE: How can I display a table in two columns?
Date Wed, 07 Apr 2004 10:32:29 GMT
This works ok for that scenario, but what about if you need each item out of
the list? eg, to iterate through a list of names:

<logic:iterate name="names" id="name">
<tr><td><bean:write name="name"/></td></tr>
</logic:iterate>

Gives one column....

<tr><td>name1</td></tr>
<tr><td>name2</td></tr>
<tr><td>name3</td></tr>
<tr><td>name4</td></tr>

Is there an easy way to get:

This would seem a fairly common scenario to me!

<tr><td>name1</td><td>name2</td></tr>
<tr><td>name3</td><td>name4</td></tr>

Daniel.


-----Original Message-----
From: news [mailto:news@sea.gmane.org]On Behalf Of bOOyah
Sent: 06 April 2004 20:47
To: user@struts.apache.org
Subject: Re: How can I display a table in two columns?


Axel Stahlhut wrote:

<snip/>

>> 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
>
> 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>

Thanks Axel.  That would probably work fine.  My list is always a fixed
size, but with variable content.

> By the way, what is the submitted value of the cb? Is it the index or
> some other kind of id?
The multibox values are actually IDs; database primary keys as it happens.

Thanks again!
--
bOOyah


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



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


Mime
View raw message