Table of Contents Previous Section

Navigating from Main to MovieDetails

To get to the MovieDetails page from the Main page, users use a hyperlink. Clicking the hyperlink should set MovieDetail's selectedMovie variable and then open the MovieDetails page.

  1. Add a hyperlink at the bottom of the Main component.

  2. Replace the text "Hyperlink" with "Movie Details."

  3. Choose Add Action from the pull-down menu.

  4. In the Add Action panel, type showDetails in the Name field.

  5. Type MovieDetails in the "Page returned" field.

  6. Click Add.

  7. Bind the showDetails action to the hyperlink's action attribute.

  8. In Project Builder, modify the showDetails action to look like the following:
    public Component showDetails()
    {
        MovieDetails nextPage =
            (MovieDetails)application().pageWithName("MovieDetails");
        EnterpriseObject selection =
            (EnterpriseObject)movieDisplayGroup.selectedObject();
    
        nextPage.setSelectedMovie(selection);
        return nextPage;
    }
    

    This method creates the MovieDetails page and then invokes its setSelectedMovie method with the movie that's selected in the Main page. The display group method selectedObject returns its selected object, which, in the Main component, is set when a user clicks a movie title hyperlink.

Table of Contents Next Section