Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > Getting Started With WebObjects


   

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 list.

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

  5. Select MovieDetails from the "Page returned" combo box.

  6. Click Add.

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

  8. In Project Builder, modify the showDetails action in Main.java to look like the following:

    public MovieDetails showDetails() {
       MovieDetails nextPage =
    (MovieDetails)pageWithName("MovieDetails");

       // Initialize your component here
       EOEnterpriseObject selection =
         (EOEnterpriseObject)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.


© 1999 Apple Computer, Inc. – (Last Updated 24 Aug 99)