Combining a string with the value of a variable to be the name of another variable in EL

后端 未结 4 1354
Happy的楠姐
Happy的楠姐 2021-02-19 07:12

I want to do something like this:


But it does not work throws exception: \"${summary${selChrm

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-19 07:52

    This is a thing that really sucks about JSTL: there's no direct way to do that if you want to do it indide a JSTL expression. There's no string concatenation operator, in other words.

    You can always do

     
    

    but that's not always useful.

    In my world, I've implemented my own "concat" function, so I can say

    $(foo:bar(mystuff:concat("something", something.else))}
    

提交回复
热议问题