if (result != null) {
try {
Iterator inputs = result.getFormInputResults();
while (inputs.hasNext()) {
FormInputResult inputResult = (FormInputResult)inputs.next();
FormInput input = inputResult.getFormInput();
Object value = inputResult.format(request);
if (input.isArray()) {
values._setInputs(input.getName(), (String[])value);
} else {
values._setInput(input.getName(), (String)value);
}
}
} catch (Exception e) {
throw new JspException(e);
}
} else {
Form form = support.getForm(request, action);
if (form == null) {
throw new JspException("Cannot find form for action '" + action + "'!");
}
try {
Iterator inputs = form.getFormInputs();
while (inputs.hasNext()) {
FormInput input = (FormInput)inputs.next();
Object value = input.format(request, formData);
if (input.isArray()) {
values._setInputs(input.getName(), (String[])value);
} else {
values._setInput(input.getName(), (String)value);
}
}
} catch (Exception e) {
throw new JspException(e);
}