struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Bacon <keithbaconstr...@yahoo.com>
Subject Re: Can nested beans be arrays in Struts1.0?
Date Mon, 11 Feb 2002 18:36:08 GMT
but use the struts <html:text tag!
Then struts will move data between the formBean & your form for you.
Otherwise you have to 

<jsp: useBean .....
<% String thingToDisplay = = formBean.getMonkey[0].getAge() %>
etc.
struts was invented to save us that pain. The tags are great!
K.



--- kothapallibc <kothapallibc@yahoo.com> wrote:
> Hi all,
> I'm a newbie to Struts. I'm trying with 1.0 release.
> 
> My FormBean is follows...
> 
> public class MonkeyForm extends ActionForm  {
> 	private Monkey[] monkey = new Monkey[5];
> 	public Monkey[] getMonkey() {  return this.monkey;  }
> 	public void setMonkey(Monkey monkey[]) {this.monkey = monkey;}
> }
> 
> public class Monkey{
> 	private String name;
> 	private String age;
> 	//Get and set methods are here
> }
> 
> Assuming that I don't want to use Struts tab libraries, how should be 
> the field names in HTML? Am I right to have them like this?
> 
>     <input type="text" name="monkey[0].name" >
>     <input type="text" name="monkey[0].age" >
>     <input type="text" name="monkey[1].name">
>     <input type="text" name="monkey[1].age">
> 	
> Somehow, these values are not populated in the form bean.
> Do I have to specify Monkey bean anywhere in struts-config?	
> 
> It works with simple arrays and when the nested bean is not an array, 
> but it doesn't if the nested bean is an array. Am I doing something 
> wrong?
> 
> Regards,
> Choudary.
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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


Mime
View raw message