Reputation:
I am using JSF 2.0. I don't want to call setter & getter multiple time. Can you help me to avoid that?
Upvotes: 3
Views: 2738
Reputation: 1108632
Why is that bothering you? Those calls are extremely cheap.
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.
Upvotes: 4