struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Reumann <strut...@reumann.net>
Subject Re: Problem with Dynamic text boxes
Date Tue, 01 Jun 2004 20:34:51 GMT
biswajit.basak@tcs.com wrote:

>  i have to display a screen in which the no of rows are dynamic. in each 
> row there are 2 text boxes where user can enter values.
>  after entering the values in the text boxes user press 'SAVE'  button . 
>  in the Action form  i have to validate the values in the validate() 
> method . also
> in the Action class  there will be some data processing.
> 
> but how can i use get(),set() methods of the Action form,as the no of 
> rows are not fixed.

Your form should take a Collection or an array of beans.. where each 
bean then has the text fields you are concerned with. (ie SomeBean would 
have get/set methods for the two text names). Think of each row 
reprenting a bean.

Then you just loop over the Collection, pull out the bean each time and 
create your two text fields. When you submit Struts will automagically 
populate all your beans correctly.

-- 
Rick

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


Mime
View raw message