You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Henry Voyer <he...@hotmail.com> on 2003/11/04 14:44:44 UTC
Help: Simple Dynaform + String Collection + JSP + populate (Repost)
Hi everyone
I have a really simple case that I just cant solve.
I have
A simple class
public class user
{
private Collection emails = new ArrayList();
private String name;
public Collection getEmails()
Public void setEmails (Collection emails) // String Collection as
hello@world.com
public void setName(String name)
public String getName()
}
Now I have mapped to it a dynaform in struts config
<form-bean name="userDynamicForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="name" type="java.lang.String" />
<form-property name="emails" type="java.util.ArrayList" />
<form-bean>
My question are :
1- how to show it in the jsp for a form input?
2- Will the BeanUtils.copyProperties(user, form); work?
For testing the input and population, i have tried the following jsp
<logic:iterate id="email" name="user" property="emails" indexId="index">
<tr>
<td width="35%"><bean:message key="user.email"/></td>
<td width="65%"> <html:text name="email" property="email" value='<%=
"user.emails.toArray()[" + index + "]" %>' indexed="true" size="28"/> </td>
</td>
</logic:iterate>
I dont have the result that I need with this.. but nevertheless I populate
my form.
But I have a exception in the Action when trying to copy the properties
using BeanUtils.copyProperties
Can anyone give me a hint or help me to solve this simple thing.
Thanks a lot
Regards and happy halloween
henry
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
http://join.msn.com/?page=dept/bcomm&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org