You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by Apache Wiki <wi...@apache.org> on 2006/08/30 18:49:56 UTC

[Struts Wiki] Update of "RolloverScope" by MichaelJouravlev

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Struts Wiki" for change notification.

The following page has been changed by MichaelJouravlev:
http://wiki.apache.org/struts/RolloverScope

New page:
Attention! This page describes a feature that has not been implemented yet!

= Rollover Scope =

In addition to standard J2EE scope objects (request, session, applicaiton) Struts supports the rollover scope. This is a virtual scope, which for most uses and purposes is identical to request scope, but its content survives till the next request comes in.

The major reason for implementing rollover scope is automatic retaining of !ActionForm object for its content to be displayed on a consecutive request (redirect-after-post pattern).

=== Storing data in rollover scope ===

When an object is stored in rollover scope, the object is actually stored in the request scope. Also the reference to the object is stored in rollover scope container. If container does not exist, it is created in request scope.

When an object is accessed from rollover scope, the data is actually read from the request scope.

Before returning the response to a client Struts verifies whether a rollover container exists. If yes, the container is saved in the session scope. A uniqie (for a given session) cookie is created and is attached to the response.

=== Handling an incoming request ===

Struts checks whether the request contains rollover cookie. If yes, session is looked up for a rollover scope that corresponds to the cookie and content of rollover scope is copied to the request object. The rollover container is not recreated. (Unique cookies are used as IDs of rollover containers in the session object, this allows to have several rollover containers, thus allowing to open several browser windows that use the same !ActionForm type.) Response object is updated to ensure that the rollover cookie expires on next request.

When user code accesses rollover scope, it actually accesses the request scope. Struts tags or JSTL tags automatically pick up data saved in rollover scope because this data has been copied back to request scope. Thus, no additional support is nesessary for tag libraries.

=== ActionForm and rollover scope ===

An !ActionForm can be configured to be stored in the rollover scope using {{{scope="rollover"}}} in an action mapping configuration.

=== 1.2 and 1.3 compatibility ===

Rollover scope is implemented both in 1.2-style RequestProcessor as well as 1.3-style Command.