Method calls in EL

前端 未结 4 1910
逝去的感伤
逝去的感伤 2020-12-19 12:58

When I write Java webapps, I usually use JSTL tags. I think that these tags are great, except for one thing that pisses me off: while the expression language allow you to ac

4条回答
  •  醉酒成梦
    2020-12-19 13:11

    I expect the goal was to enforce strict model-view separation, as in StringTemplate.

    The idea is pretty simple: If you don't have access to methods, then you are forced to compute all of your data in the controller and then just format it in the view. Of course they muddied the message by allowing you to have access to functions and they were not helped by the fact that it is not as easy to build up lists of maps of tuples (read: structured data without classes) in Java as it is in Python, Ruby, etc.

    Anyway, here's an article on writing a tag that allows you to call arbitrary methods, might find it helpful.

提交回复
热议问题