this.endProcessing = null;
this.isValid = false;
// Notify the end of the current phase
if (this.listener != null) {
this.listener.phaseEnded(new ProcessingPhaseEvent(this, this.phase));
}
this.phase = ProcessingPhase.READ_FROM_REQUEST;
// Find the submit widget, if not an action
this.submitWidget = null;
String submitId = formContext.getRequest().getParameter("forms_submit_id");
if (submitId != null && submitId.length() > 0) {
StringTokenizer stok = new StringTokenizer(submitId, ".");
Widget submit = this;
while (stok.hasMoreTokens()) {
submit = submit.lookupWidget(stok.nextToken());
if (submit == null) {
throw new IllegalArgumentException("Invalid submit id (no such widget): " + submitId);
}
}
setSubmitWidget(submit);
}
try {
// Start buffering events
this.bufferEvents = true;
doReadFromRequest(formContext);
// Fire events, still buffering them: this ensures they will be handled in the same
// order as they were added.
fireWidgetEvents();
} finally {
// No need for buffering in the following phases
this.bufferEvents = false;
}
// Notify the end of the current phase
if (this.listener != null) {
this.listener.phaseEnded(new ProcessingPhaseEvent(this, this.phase));
}
if (this.endProcessing != null) {
return this.endProcessing.booleanValue();
}
// Validate the form
this.phase = ProcessingPhase.VALIDATE;
this.isValid = doValidate();
if (this.endProcessing != null) {
return this.endProcessing.booleanValue();
}
// Notify the end of the current phase
if (this.listener != null) {
this.listener.phaseEnded(new ProcessingPhaseEvent(this, this.phase));
}
if (this.endProcessing != null) {
// De-validate the form if one of the listeners asked to end the processing
// This allows for additional application-level validation.