So what exactly is #this in OGNL?

So what exactly is #this in OGNL?

August 7, 2013

We have used the variable #this in several of the previous articles in this series, in this one we will take a closer look at what it is and what it provides.


Most of the expressions used in this article can be tested without having to run the connection through an SSO event; but instead using the Edit option then running Test to test the expression in the Administration console. When you select Expression as the Source you will see the option to Edit under Actions. By selecting Edit it will take you to a page where you can enter test values for the available attributes then once test your expression.


See the complete list of articles in my OGNL series at the end of this post.


We first discussed edit in the second article, but some expressions cannot be tested without actually running it like the one we did in the looping article.


Selecting Edit:


Will get you:


OGNL as we said with the first article of this series is Java and runs in a Java Virtual Machine after it is interpreted. This means that the #this variable is a Java object, to find out what it is, you use the following expression:



By selecting Test in Edit mode you will see:


You see that the result is a java.util.HashMap reviewing the Javadocs for this class you see that it is a set that contains name(keys)/value pairs. You can get names or keys by using the following expression:



The results:


As you can see this is a list of the variables that are available to us from the PingFederate server. Using the following expression:



We can get a specific attribute with the get method and explore what type of object it is, as shown below:


We will continue exploring the possibilities of the #this variable in the next issue, so see you next week. In the meantime please leave a comment on this post and let me know what topics you would like to see.




OGNL Blog Series:


  1. Introduction to OGNL
  2. A simple OGNL expression
  3. Declaring variables in OGNL
  4. Method calls in OGNL
  5. Arrays in OGNL
  6. OGNL: What about those curly braces?
  7. Looping in OGNL
  8. Looping in OGNL take 2
  9. So what exactly is #this in OGNL?
  10. A continuing look at #this variable in OGNL
  11. Functions in OGNL
  12. Misc Topics in OGNL


John DaSilva develops training and solutions at Ping Identity.