struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sean jones <sean.jo...@ubs.com>
Subject Re: Problem with Dynamic text boxes
Date Tue, 01 Jun 2004 14:29:21 GMT
 <biswajit.basak <at> tcs.com> writes:

> 
> 
> hi 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.i am trying to avoid the 
request.getParameter('Field
> name'); in the Action form or in Action Class.Any Suggestion! Thanks
> Biswajit Basak
> 

in your action form you can do this.

String text1[];
string text2[];

public void setText1(String text[]) text1 = text; }
public void setText2(String text[]) text2 = text; }
public String getText1() {return text1; }
public String getText2() {return text2; }


validate() {

if (text1.length != text2.length) {
//save this error here.
}
else {
   //loop through arrays validating each pair.
   //and saving appropriate errors. 
}



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


Mime
View raw message