Apple WebObjects 3.5 Manuel d'utilisateur Page 62

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 218
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 61
Chapter 4 Debugging a WebObjects Application
62
The pageWithName method creates the page by looking up and instantiating
the component class that has the same name as the argument you provide
to
pageWithName. For this reason, your subclass of Component shouldn’t be
given a package name. For example, if you create a component named
MyPage.wo and place its Java file in the package myClasses.web, pageWithName won’t
find the
MyPage.class file.
Java is a more strictly typed language than is Objective-C or WebScript. If
you’re more familiar with Objective-C, you’ll find that you need to cast the
return types frequently. For example, suppose you define a method named
verify in the file Session.java and you want to invoke that method from a
component’s Java file. To do so, you must cast the return type of the
component’s
session method as in the following:
// From a component’s Java file.
((Session)session()).verify();
By definition, session returns a WebSession object. Because WebSession
does not define a method named
verify, your code won’t compile unless you
cast the return value of
session to your WebSession subclass.
Vue de la page 61
1 2 ... 57 58 59 60 61 62 63 64 65 66 67 ... 217 218

Commentaires sur ces manuels

Pas de commentaire