title: Passing parameters to a controller when loading an FXML
body: <p>I have a login screen, and I want to pass the login ID from the LoginController to the MainController, so I can access some functions to change password and whatnot. </p>
  
  <p>I load the controller like this: </p>
  
  <pre><code>FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("fxml/Main.fxml"));     
  
  Parent root = (Parent)fxmlLoader.load();          
  Scene scene = new Scene(root); 
  
  stage.setScene(scene);    
  
  stage.show();   
  </code></pre>
  
  <p>Main.fxml is bounded to the MainController.java. 
  Is there a way I can pass the user ID I need, and access it on the initialize() method of the controller?</p>