while (modelIterator.hasNext()) {
XFormModel model = (XFormModel) modelIterator.next();
final XFFormAttributes xfFormAttributes =
model.getXFFormAttributes();
final EmulatedXFormDescriptor fd = model.getXFormDescriptor();
MarinerPageContext pageContext = protocol.getMarinerPageContext();
FormDataManager formDataManager = pageContext.getFormDataManager();
// Store the form data in the XFFormAttributes.
xfFormAttributes.setFormData(model.getFormData());
// Get the form data from the session context. The act of
// retrieving it causes it to be created if it isn't already there.
SessionFormData formData = formDataManager.getSessionFormData(fd);
// The fd in the session is built up over requests for subsequent
// fragments, so add the fields found in this request to it.
formData.addFieldDescriptors(fd.getFields());
// Set the form specifier (which identifies the form in the
// session) on the form descriptor and form attributes.
String formSpecifier = formData.getFormSpecifier();
xfFormAttributes.setFormSpecifier(formSpecifier);
// Store everything else in the form descriptor and store it.
fd.setFormSpecifier(formSpecifier);
fd.setFormAttributes(xfFormAttributes);
}
}