I have 2 variable in my action class, id1 and id2. Joined by a _, they’re used as a map key.
I am not able to retrieve the map value using this code:
<s:property value="%{mymap[id1_id2]}" />
How should I retrieve the map value?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The expression
id1_id2in OGNL will assume the presence of a variable namedid1_id2, since it’s a perfectly legal identifier.If you want to concatenate strings, you’d need:
I’d likely create a separate variable to use as the key:
Or more likely, I’d do it somewhere besides the view layer.