requestScope (JavaScript)

Allows you to share values across pages for the duration of a request.

This global object is based on the Java class com.sun.faces.context.RequestMap which includes the following methods:
put(p0:java.lang.Object, p1:java.lang.Object) : java.lang.Object
get(p0:java.lang.Object) : java.lang.Object
For example, a button on a page might contain the following code for the onClick event:
requestScope.put("hello", "Hello request");;
context.redirectToPage("page2");
A label on a second page (page2) might have the following formula:
requestScope.get("hello");

If a user clicks the button on the first page then opens the second page, Hello request appears as the label.

The value persists only for the request. For example, if the onClick code is only requestScope.hello = "Hello request" and you open page2 by some other means, Hello request does not appear as the label.

The name of the value and the value can be any object. For example, you can use the following combinations:
requestScope.put(1, "Hello request");
requestScope.get(1);

requestScope.put("n", 99);
requestScope.get("n");
You can also assign values as properties. For example, you can assign a value on the first page as follows:
requestScope.hello = "Hello request";
context.redirectToPage("page2");
On the second page, you can reference the value as follows:
requestScope.hello;
You can bind a requestScope variable to a control. For Data source, select EL Scopes. For Data binding, select requestScope. You will see #{requestScope.}. Type the name of the variable after the period, for example:
#{requestScope.hello}