Yangrui
Yangrui

Reputation: 1247

How to detect a method called in another bean?

I have two Java beans for my webapp: one is the userController and the other is the profileController. Both of them are conversation scoped. I want that when the current user in the userController is changed, the profileController detects the change and changes its current profile. How to achieve this?

Upvotes: 4

Views: 82

Answers (2)

Ahmet Karakaya
Ahmet Karakaya

Reputation: 10139

There has to be a mechanism that listen each other. You can use Observer Pattern.

Upvotes: 0

psabbate
psabbate

Reputation: 777

You could achieve this using the Observer Pattern.

Observer Pattern Wiki

The ProfilerController should suscribe to UserController events.

Upvotes: 1

Related Questions