formData = support.getFormData(request, action, false);
} catch (Exception e) {
throw new JspException("Cannot get form data for action '" + action + "'!");
}
if (formData instanceof FlushableForm) {
FlushableForm values = (FlushableForm)formData;
FormResult result = support.getFormResult(request, action);
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);
}