You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Struts Newsgroup (@Basebeans.com)" <st...@basebeans.com> on 2002/07/22 13:25:02 UTC

html:radio and iterate tag

Subject: html:radio and iterate tag
From: "Issam Mouslim" <im...@islandis.com>
 ===
Hello folks,
    Is there any way to index html:radio with my own index?
Here is my code: I want to have an unknown number of radio per line
I have 2 iterate one for the lines, the second containing my radio is for
columns. I want my radios to be index by the index of the first iterate (ie:
lines)

<table class="intro" width="100%">
 <tr>
  <td width="25%">&nbsp;</td>
  <logic:iterate id="access" name="AccessTable" property="entries"
type="beans.AccessLevel">
   <td bgcolor="#CCCCCC">
    <bean:write name="access" property="code"/>
   </td>
  </logic:iterate>
 </tr>
 <logic:iterate id="center" name="CenterTable" property="entries"
type="beans.Center">
  <tr>
   <td align="right" width="25%">
    <bean:write name="center" property="name"/>
   </td>
   <logic:iterate id="access" name="AccessTable" property="entries"
type="beans.AccessLevel">
    <td bgcolor="#CCCCCC">
     <html:radio property="userAccess" indexed="true" idName="access"
value="accessLevelId"/>
    </td>
   </logic:iterate>
  </tr>
 </logic:iterate>
</table>

Thanks



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: html:radio and iterate tag

Posted by Arnaud HERITIER <ah...@sopragroup.com>.
I can propose a solution but it will work only with struts 1.1 because it
uses indexed properties.

In your first iterate you should define an indexId. For example :

<logic:iterate id="access" indexId="myIndex" name="AccessTable"
property="entries" type="beans.AccessLevel">

Then in the html:radio you use an indexedproperty:

<html:radio property="<%=\"userAccess[\"+myIndex+\"]\"%>" idName="access"
value="accessLevelId"/>

The property "userAccess" of your form bean must to be a String[]

Arnaud

> -----Message d'origine-----
> De : Struts Newsgroup [mailto:@Basebeans.comstruts@basebeans.com]
> Envoyé : lundi 22 juillet 2002 13:25
> À : struts-user@jakarta.apache.org
> Objet : html:radio and iterate tag
>
>
> Subject: html:radio and iterate tag
> From: "Issam Mouslim" <im...@islandis.com>
>  ===
> Hello folks,
>     Is there any way to index html:radio with my own index?
> Here is my code: I want to have an unknown number of radio per line
> I have 2 iterate one for the lines, the second containing my
> radio is for
> columns. I want my radios to be index by the index of the
> first iterate (ie:
> lines)
>
> <table class="intro" width="100%">
>  <tr>
>   <td width="25%">&nbsp;</td>
>   <logic:iterate id="access" name="AccessTable" property="entries"
> type="beans.AccessLevel">
>    <td bgcolor="#CCCCCC">
>     <bean:write name="access" property="code"/>
>    </td>
>   </logic:iterate>
>  </tr>
>  <logic:iterate id="center" name="CenterTable" property="entries"
> type="beans.Center">
>   <tr>
>    <td align="right" width="25%">
>     <bean:write name="center" property="name"/>
>    </td>
>    <logic:iterate id="access" name="AccessTable" property="entries"
> type="beans.AccessLevel">
>     <td bgcolor="#CCCCCC">
>      <html:radio property="userAccess" indexed="true" idName="access"
> value="accessLevelId"/>
>     </td>
>    </logic:iterate>
>   </tr>
>  </logic:iterate>
> </table>
>
> Thanks
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>