If a component is marked with request scope, simultaneous requests each see a different instance of the component. This is true even when the same session sends two requests simultaneously; each request gets a pointer to a separate object. Each instance is handled independently and has no effect on the others.

Request scope can be especially useful for components whose properties are set by a form. When a form is submitted, the component values are set by the appropriate setX methods, and actions are performed by handleX methods.

If two forms are submitted at the same time to the same component, one submission might overwrite the setX methods of the other. This is especially true for globally-scoped components, which are highly vulnerable to multiple simultaneous requests from different sessions; with a session-scoped component, multiple simultaneous requests occur only if the user submits the form twice in very rapid succession. As a general rule, it is a good idea for forms to use request-scoped components; this ensures that only one request at a time can set their properties.

Note: To ensure that multiple requests do not access the same component simultaneously, you can also set the synchronized attribute in the form tag. With this attribute, the Oracle ATG Web Commerce platform locks the specified component before setting any properties, and releases the lock only after form submission is complete. Other form submissions can set the component’s properties only after the lock is released. For more information, see the Forms chapter in the ATG Page Developer's Guide.

Preserving Request Scoped Objects on Redirects

If a request results in a redirect to a local page through the method HttpServletResponse.sendLocalRedirect(), the Oracle ATG Web Commerce platform treats the redirect request as part of the original request, and maintains any request-scoped objects associated with that request. To implement this, the Oracle ATG Web Commerce platform adds an additional query parameter named _requestid to the redirected URL.