Persistence

Forms can consist of more than one Page. If this is the case, only one Page of a Form is shown to a visitor at any one time. After a visitor has filled in a Form Page, the data that the user has filled in needs to be stored somewhere. The storage of this data is called persistence.

WebForms Server maintains a separate session for each instance of a form being filled in. A new session starts when a visitor starts to fill in a Form on an ASP, ASP.NET or JSP page. The session ends when the visitor submits the form on the last Form Page, provided that all relevant fields contain valid values.

The WebForms Server assigns to each session a unique ID in order to distinguish between visitors.

For each session, persistent storage maintains:

  • the data the visitor has filled in so far
  • any uploaded files
  • the Form Page that the visitor is currently on
  • a timestamp that indicates when the session was started
  • a timestamp that indicates when the last request of the session was received

When a session ends and the Form has been submitted to the back office, all data in persistent storage for this specific session is removed.

The persistence manager uses a pluggable back-end storage to store the data. This back-end storage is defined using the following Java interface:

public interface PersistentStorage {
  void put(String sessionId, String key, Object value) 
    throws StorageException;
  Object get(String sessionId, String key) throws StorageException;
  void remove(String sessionId, String key) throws StorageException;
  void clear(String sessionId) throws StorageException;
}

The data is stored under a session ID. The session ID corresponds to a session in which a single user fills in a single form.

The data that is not on the current page is kept on the server. When the user submits a Form Page, the saved Form data is retrieved and updated with the submitted data.

When a session ends — usually after a visitor has submitted the last Form Page — persistent storage is cleared.