I have three layers Root layout, home, content (rootLayout.fxml, home.fxml and content.fxml)
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(GenerateReport.class
                .getResource("/skin/rootLayout.fxml"));
        rootLayout = (AnchorPane) loader.load();
        Scene scene = new Scene(rootLayout);
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(GenerateReport.class
                .getResource("/skin/home.fxml"));
        AnchorPane homeLayout = (AnchorPane) loader.load();
        rootLayout.getChildren().addAll(homeLayout);
        .
        .
        .
        rootLayout.getChildren().addAll(contentLayout);
like this I am adding content layout. In rootLayout.fxml i have a home button. My requiredment is if a user clicks home button then i want content layout to be removed and home layout to be visible.
content.fxml
<AnchorPane id="myContent" ... fx:controller="com.ReportController">
rootLayout.fxml
<AnchorPane id="AnchorPane" .. fx:controller="com.ReportController">
    <children>
        <Button fx:id="home" onAction="#homeBtn" .../>
    </children>
</AnchorPane> 
In my Controller (In all the fxml file i am pointing to the same controller) class i created
@FXML
private Button home;
@FXML
private AnchorPane myContent;
@FXML
protected void homeBtn(ActionEvent event) throws Exception {
    System.out.println("click! homeBtn");
    myContent.getChildren().clear();
}
The problem i am facing is i am getting NullPointerException. i.e. myContent.getChildren() is returning null. Could anyone help me in resolving this issue.