使用EL 2.1的JSPX EL 2.2方法调用 [英] JSPX EL 2.2 method calling using EL 2.1

查看:87
本文介绍了使用EL 2.1的JSPX EL 2.2方法调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我拥有的JSP在Tomcat 7中可以正常工作,但在Tomcat 6中却无法工作,我认为这是事实,您不能从EL 2.1调用方法(除getters/setter之外).

I have JSP that works fine in Tomcat 7 but does not work in Tomcat 6 which I assume is the fact that you cannot call methods (other than getters/setter) from EL 2.1.

我需要调用的方法不能命名为吸气剂.

The method I need to call cannot be named as a getter.

推荐答案

我想出了一种解决方法,并认为我会发布答案:

I figured out a workaround and thought I would post the answer:

如果安装了Spring,则可以使用Spring EL,以便可以在对象上调用方法

If you have Spring installed you can use Spring EL so that you can call methods on objects

例如:

<spring:eval expression="pic.thumbnailUrl()" var="thumbnail" />

这篇关于使用EL 2.1的JSPX EL 2.2方法调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆