Difference between specifying JSTL value via attribute and body

前端 未结 2 647
孤独总比滥情好
孤独总比滥情好 2021-01-15 02:41

I\'m trying to figure out if there\'s any functional difference between these two uses of the JSTL tag. Let\'s assume I have imported some string

2条回答
  •  Happy的楠姐
    2021-01-15 03:17

    According to O'Reillys HeadsFirstServlets pg 457, why would you use the body version of c:set instead of the no-body version. It looks like they do the same thing.

    Answer:

    That’s because they DO... do the same thing. The body version is just for convenience when you want more room for the value. It might be a long and complex expression, for example, and putting it in the body makes it easier to read.

    Update

    After some additional research it turns out the above reasoning pertains only to EL v2.2 and lower. See the answer by BalusC for 3.0 behavior.

提交回复
热议问题