# How Do I: Access Data Binding Contexts in Scriptlet and JavaScript?

This topic describes how to access variables in the various data binding context objects such as pageFlow, actionForm, and container from a JSP scriptlet and JavaScript. To learn more about data binding contexts, including the scope of the various contexts and how to add data to these contexts, see Using Data Binding in Page Flows.

To Access Data Binding Contexts in Scriptlet

- pageFlow, globalApp, actionForm, and container. Variables in these contexts must be added to the pageContext before they can be accessed in scriptlet using pageContext.getAttribute. For detailed information, read the pageContext section in Using Data Binding in Page Flows.
- url. Attributes on the URL can be accessed in scriptlet by using the getParameter method of the request context object, as is shown in the following example:

  <% String value = request.getParameter("User_Index"); %>

- request, session, application, and pageContext. These data binding contexts can be accessed directly in scriptlet by referencing the actual context name. For instance, to get a attribute of a request, you would do this:

  <% String value = (String) request.getAttribute("AttributeKey"); %>

  In this example, the object (value) corresponding to the AttributeKey key is retrieved.

To Access Data Binding Context in JavaScript

A common use of JavaScript in which dynamic data needs to be accessed is client-side form validation. Here the user's input in form fields is checked before data is passed back to the server, possibly for server-side validation. To learn more about how to access data in the actionForm object in JavaScript, see Validating User Input.

Related Topics

Using Data Binding in Page Flows

Validating User Input

Presenting Complex Data Sets in JSPs