Struts 2 makes extensive use of OGNL in order to retrieve the values of elements. OGNL stands for Object Graph Navigation Language. As the name suggests, OGNL is used to navigate an object graph. In this post, i am going to use the containsKey('Key') method over a map and OGNL syntax to check the key is exist or not. Here is the example:
Here i am assuming your userDetailsMap is exposed through a getter directly by the Action.
<s:if test="userDetailsMap.containsKey('User')"> |
Check this link for OGNL references :
http://commons.apache.org/proper/commons-ognl/language-guide.html
0 comments:
Post a Comment