struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: arrays
Date Wed, 02 Jul 2003 08:20:18 GMT
Use an iterate taglib tag - there's the standard struts ones or the JSTL 
ones. Or even the nested-beans tags. There are many ways to do this. 
Check out the Resources section on the struts website for examples or 
tutorials.

Adam

Eugen Bushuev wrote:
> Hi.
> I need to present user with list of some items (say, goods) as 
> textfields and correspondent submit buttons to easy update those values. 
> In PHP it looks something like that:
> <?
>  if (!is_array($items)) {
>    $items = array(1=>"aaa", 2=>"bbb", 3=>"ccc");
>  }
> 
>  if (is_array($save)){
>    $key = current(array_keys($save));
>    $items[$key] = $items[$key];
>  }
> 
> ?>
> <html>
> <form action=test.php method=post>
>  <?
>    foreach (array_keys($items) as $key){
>      echo "
>        <input type=text   name=items[$key] value=\"$items[$key]\">
>        <input type=submit name=save[$key]       value=\"Save\">
>        <br><br>
>      ";
>    }
>  ?>
> </form>
> </html>
> 
> How should it be done in Struts? Using plain jsp i used to do almost all 
> the same as in PHP, but it looked quite clumsy (submit name was parsed 
> for index, etc...).
> 
> wbr, eugen.
> 
> 
> 


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


Mime
View raw message