I've looked through the mail list but still can't get multiple selections to
display.
I'm working on a form that can create or edit a particular role and it's
functions I want to (in create mode) select multiple functions and then in
edit mode display those multiple functions selected in a multiple select
listbox. Do I need a separate bean for the array that holds the particular
selections of the edited role? Do I need an iterate tag of some sort? I'm
able to populate my list box with only the first item in the array from my
action. Using println I can see that I populated my array with the data I'm
looking for. Any help would be appreciated.
I have in my jsp
java.util.ArrayList list = new java.util.ArrayList();
FunctionData[] allFunctions = (FunctionData[])
session.getAttribute("allFunctions");
for(int k = 0;k< allFunctions.length;k++)
{
list.add(new
apex.ace.web.actions.LabelValueBean(allFunctions[k].getName(),allFunctions[k
].getPK().toString()));
}
pageContext.setAttribute("serverTypes",list);
<html:select property="type" size="16" name="SubmitRoleForm"
multiple="true">
<html:options collection="serverTypes"
name="label" Property="value" labelProperty="label"/>
</html:select>
In my formbean
I have getType() and setType() for String[] type
in the my action I have
String[] type = new String[role.getFunctions().size()];
int i = 0;
Iterator it =
role.getFunctions().values().iterator();
while(it.hasNext())
{
type[i] =
it.next().toString().substring(21);
i++;
}
for (int j = 0;j< type.length;j++){
System.out.println(type[j]);
}
// Populate the subscription form
if (form == null)
{
if (servlet.getDebug() >= 1)
servlet.log(" Creating new Form bean under
key "
+ mapping.getAttribute());
form = new SubmitRoleForm();
session.setAttribute("SubmitRoleForm", form);
SubmitRoleForm subform = (SubmitRoleForm)
form;
subform.setRoleEdited(roleEdited);
subform.setAction(action);
subform.setName(name);
subform.setKey(key);
subform.setType(type);
Joel Schmidt
<Software Engineer>
Apex Learning
Phone 425.468.6790
Ext 6790
Email [EMAIL PROTECTED]