Using JSF 2.0 and Spring, I use an @RequestScope
managed bean. This bean stores information about the logged-in user. It loads the user from the DB in a @PostConstruct
method:
@PostConstruct
public void init() {
String username = login.getUsername();
user = userDao.load(username);
}
The logged-in user can then trigger on action on the page that updates the user in database (using another managed bean).
However, the @RequestScope
bean is constructed at the beginning of the request, which is before the call to the updating action. As a result, when the page is redisplayed, the User
variable still has its old values.
My question is: do I have a way to run my loading method not at the beginning of the request, but after the request has been sent? Or am I dealing with this in the wrong way?
Thanks for your insight,
Sébastien