JSF呼叫设置器&多次吸气 [英] JSF calling setter & getter multiple times

查看:115
本文介绍了JSF呼叫设置器&多次吸气的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JSF 2.0.我不想打电话给塞特&多次吸气. 您能帮我避免这种情况吗?

I am using JSF 2.0. I don't want to call setter & getter multiple time. Can you help me to avoid that?

推荐答案

为什么要打扰您?这些电话非常便宜.

Why is that bothering you? Those calls are extremely cheap.

也许您错误地在getters/setter中而不是在(post)构造函数和/或action(listener)方法中调用昂贵的业务逻辑?在JSF中,这确实是一个非常常见的入门错误.只是不要在getter/setter中调用业务逻辑.而是在(post)构造函数和/或action(listener)方法中调用业务逻辑. Getter/setter纯粹是用来获取和设置(已经准备好的)bean属性的.

Perhaps you're incorrectly invoking expensive business logic in getters/setters instead of in (post)constructor and/or action(listener) methods? That's indeed a very common starter's mistake in JSF. Just don't invoke business logic in getters/setters. Invoke business logic in (post)constructor and/or action(listener) methods instead. Getter/setters are purely meant to get and set the (already-prepared) bean properties.

这篇关于JSF呼叫设置器&多次吸气的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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