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