I do something like this. It may not compile (esp. myformbean.getListSize()) and
should use logic:iterate. Hope it helps;
JSP;
%
int i;
for (i = 0; i myformbean.getListSize(); i++) {
String fieldName = value( + i + );
%
html:text property=%=name% /
br/
%
}
String fieldName = value( + i+1 + );
%
html:text property=%=name% / !-- new row --
class MyForm {
List list;
int getListSize() { return list.size(); }
String getValue(int i) { return (String) list.get(i); }
String setValue(int i, String s) {
if ( i list.size()-1 ) list.add(s);
}
}
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 02 April 2003 10:09
To: Struts Users Mailing List
Subject: how to add a new record to a table
Hi,
I guess my problem is common but I couldn't find an answer on the
archive...
I have a bean that provides an indexed property (a java.util.List).
I have this list displayed on a jsp page with a table and I would like the
last row of the table to be editable.
When the user submits the form, I would like the last row (the editable
one) to be added as a new entry in the indexed property
Any advise for how to do that ?
Thanks
Thomas
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Visit our website at http://www.ubswarburg.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]