struts-user  

arrays

Eugen Bushuev
Wed, 02 Jul 2003 00:37:16 -0700

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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]