我可以在java bean中调用我的函数,但不能使用get和set



我用这个例子从Per

http://per.lausten.dk/blog/2012/02/creating-your-first-managed-bean-for-xpages.html

我可以使用

helloWorld.setSomeVariable("test")

使用 helloWorld.getSomeVariable() 获取值

但是当我尝试使用 EL 语言时,它不起作用helloWorld.SomeVariable

我收到一个错误,指出helloWorld中不存在某个变量

我可能正在做一些简单的错误,但我看不到是什么。

我相信问题是 EL 可能区分大小写,属性的 bean 样式名称是"someVariable"。Bean 假设您使用驼峰大小写作为方法名称,因此 EL 将"set"和"get"之后的第一个字母下写以进行翻译。

EL 在我看来似乎是区分大小写的,您的属性被定义为 someVariable 而不是 SomeVariable。 你有没有试过helloWorld.someVariable。

最新更新