JSF的托管bean中的getter和setter都是必需的吗? [英] Are both getters and setters mandatory in JSF's managed beans?

查看:123
本文介绍了JSF的托管bean中的getter和setter都是必需的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JSF组件,它是从托管bean的getter getProperty()初始化的.在该托管bean中还必须有一个setter setProperty()是强制性的吗?

I have a JSF component which is initialized from a managed bean's getter getProperty(). Is it mandatory to also have a setter setProperty() in that managed bean?

推荐答案

这要视情况而定.

某些属性绑定必须是可读写的.例如,如果您绑定实现

Some property bindings must be read-write. For example, if you bind the value of a component that implements EditableValueHolder. Other properties can be read-only.

如果使用binding属性动态创建组件实例,则还必须根据规范中定义的合同对此文件进行读写.

If you use the binding attribute for dynamically creating component instances, this must also be read-write as per the contract defined in the specification.

这篇关于JSF的托管bean中的getter和setter都是必需的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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