Javatpoint Logo

91-9990449935

 0120-4256464

Struts 2 OGNL Tutorial

The Object Graph Navigation Language (OGNL) is an expression language. It simplifies the accessibility of data stored in the ActionContext.

The struts framework sets the ValueStack as the root object of OGNL. Notice that action object is pushed into the ValueStack. We can direct access the action property.

Here, username is the property key.

The struts framework places other objects in ActionContext also e.g. map representing the request, session, application scopes.

To get these values i.e. not the action property, we need to use # notation. For example to get the data from session scope, we need to use #session as given in the following example:

(or)