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

Fre*_*ing 1 xpages

我使用Per中的这个例子创建了一个简单的bean

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

我可以使用访问bean

helloWorld.setSomeVariable("test")

使用helloWorld.getSomeVariable()获取值

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

我得到一个错误,在helloWorld中不存在SomeVariable

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

Jes*_*her 7

我认为问题是EL可能区分大小写,属性的bean风格名称是"someVariable".Beans假设您使用驼峰大小写的方法名称,因此EL会在"set"和"get"之后为其翻译下载第一个字母.