title: JSF2.0: ManagedProperty Lifecycle?
body: <p>I have a problem I don't understand: Behind any View I have a controller ManagedBean that is RequestScoped and a data ManagedBean, that holds the data for the view and is SessionScoped.</p>
  
  <p>So there are two views, which are login with loginData and loginController and overview with overviewData and overviewController.</p>
  
  <p>The functionality should be like that: </p>
  
  <ul>
  <li>The User logs into the application (loginController method)</li>
  <li>If Authentication is successfull, there is a redirect to overview.xhtml (again in loginController method)</li>
  <li>Then the overviewData gets its data by the overviewController, which retrieves them from business logic layer </li>
  <li>The overview.xhtml shows the retireved data</li>
  </ul>
  
  <p>So, the point is that I want to fill overviewData out of loginController, right after login! (???or if possible right befor overview view is constructed, if possible???).</p>
  
  <p>I tried it with managedProperties, but the one I initiate in loginController is a different object than the managedProperty in overviewController, although they have the same name! How is that possible.</p>
  
  <p>Oh boy, I doubt you guys understand what I mean, so I need to post some code:</p>
  
  <p><em>LoginController.java</em></p>
  
  <pre><code>...    
      @ManagedBean
      @RequestScoped
      public class LoginController {
  
      @ManagedProperty(value = "#{overviewData}")
      private OverviewData overviewData;
      OverviewController overviewController;
  
      public LoginController(){
          overviewController = new OverviewController ();
      }
  
      String login() throws Exception {
        UsernamePasswordToken token = new UsernamePasswordToken(loginData.getName(), loginData.getPw().trim());
        try {
        currentUser.login(token);
        overviewController.fillProjects();
  ...
  </code></pre>
  
  <p><em>OverviewController.java</em></p>
  
  <pre><code>...    
      @ManagedBean
      @RequestScoped
      public class OverviewController {
  
      @ManagedProperty(value = "#{overviewData}")
      private OverviewData overviewData;
  
      public void fillProjects(){
        if(overviewData == null){
          overviewData = new OverviewData();
        }
        overviewData.setProjects(projectService.getProjects()); //retrieves data from business logic
      }
  ...
  </code></pre>
  
  <p><em>OverviewData.java</em></p>
  
  <pre><code>...
      @ManagedBean(name = "overviewData")
      @SessionScoped
      public class OverviewData {
  
      private List&lt;ProjectDTO&gt; projects;  //that's what the view needs to display the overview
  
      public void setProjects(List&lt;ProjectDTO&gt; projects) {
        this.projects = projects;
      }
  ...
  </code></pre>
  
  <p>I hope that helps to show my problem, if you don't understand it, pls ask in a comment..</p>
  
  <p>Would be nice if you can help me :-)</p>
  
  <p>Cheers...</p>