Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个变量 x 等于“牛津”。
${Place['name_oxford']} will give result as england.
但是如果我尝试${Place['name_'+x]}我会得到错误。
${Place['name_'+x]}
如何解决这个问题?
+运算符不会在 中连接字符串,EL您必须使用String.concat方法。
+
EL
String.concat
你可以尝试这样的事情:
${Place['name_'.concat(x)]}