Reputation: 17269
I have a map in jsp
<s:set name="answer" value="#{0:'No', 1:'Yes', 2:'Maybe' }"/>
How to access the answer map using the key?
<s:property value="?"/>
Upvotes: 0
Views: 340
Reputation: 160201
Edit: Sorry, mis-read on mobile device.
#theMap[theKey]
Variables created with <s:set>
are named variables and must be accessed using the leading #
.
Upvotes: 1
Reputation: 3514
Try this
<s:set name="answer" value="#{'0':'No', '1':'Yes', '2':'Maybe' }"/>
<s:property value="#answer['1']"/>
Upvotes: 1