user1335654
user1335654

Reputation:

JSF calling setter & getter multiple times

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

Answers (1)

BalusC
BalusC

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.

See also:

Upvotes: 4

Related Questions