struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Morris" <David.Mor...@plumcreek.com>
Subject RE: Dynamic Forms
Date Fri, 21 Jun 2002 17:17:38 GMT
Koen,

It is pretty simple. The following should work. 

ArrayList dynValues = new ArrayList();
...
public ArrayList getDynValues() {
  return dynValues;
}
public void setDynValues(ArrayList dynValues)
  this.dynValues = dynValues;
}

For the example I gave was simplified. I always use 
a bean for updatable properties so on my form I declare 
that bean, which contains the ArrayList and has the 
actual getter and setter. If that bean is named someBean 
on the form, the nested:iterate tag property is actually 
something like property="someBean.dynValues".

David Morris

>>> Koen.Puttevils@cronos.be 06/21/02 01:34AM >>>
David,

This is probably a very newbie question, but how are you gonna define
your getters and setters in your form bean?

Greetz,
Koen

-----Original Message-----
From: David Morris [mailto:David.Morris@plumcreek.com] 
Sent: Thursday, June 20, 2002 7:49 PM
To: struts-user@jakarta.apache.org 
Subject: RE: Dynamic Forms


Adrian,

Would it work to store your property name/values pairs 
in an arrayList and then use iterate or the nested tags 
to loop through the values when you display them? The 
generated text tag would then be something like 
property="dynValues[0].value" value="Some Value". You 
would build the arrayList of dynProps each one having a 
value, name pair.

  <nested:root name="yourBeanIfNotOnForm">
    <nested:iterate property="dynValues">
      <tr><td><nested:text property="value"/></td></tr>
    </nested:iterate>
  </nested:root>

David Morris


--
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