Apple WebObjects 3.5 Bedienungsanleitung Seite 45

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 218
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 44
Action Methods
45
// Java example
public Component showPart() {
Error errorPage;
Inventory inventoryPage;
if (isValidPartNumber(partNumber)) {
errorPage = (Error)application().pageWithName("Error");
errorPage.setErrorMessage("Invalid part number " +
partnumber);
return errorPage;
}
inventoryPage = (Inventory)
application().pageWithName("Inventory");
inventoryPage.setPartNumber(partnumber);
return inventoryPage;
}
Action methods don’t have to return a new page. They can instead direct
the application to use the request page as the response page by returning
nil
(
null in Java). For example, in the Visitors application, the recordMe action
method in the Main page records the name of the last visitor, clears the text
field, and redraws itself:
// WebScript Visitors Main.wos
- recordMe
{
if ([aName length]) {
[[self application] setLastVisitor:aName];
[self setAName:@""]; // clear the text field
}
}
// Java Visitors Main.java
public Component recordMe
{
if (aName.length != 0) {
((Application)application()).setLastVisitor(aName);
aName = ""; // clear the text field
}
return null;
}
Note: Always return nil (null) in an action method instead of returning self (this).
Returning
nil uses the request component as the response component.
Returning
self uses the current component as the response component. At
first glance, these two return values seem to do the same thing. However, if
the action method is in a component that’s nested inside of the request
component, a return value of
self will make the application try to use the
nested component, which represents only a portion of the page, as the
response component. This, most likely, is not what you want. Therefore, it
is safer to always return
nil.
Seitenansicht 44
1 2 ... 40 41 42 43 44 45 46 47 48 49 50 ... 217 218

Kommentare zu diesen Handbüchern

Keine Kommentare

Diodes DESD5V0S1BB manuals

Owner’s manuals and user’s guides for Hardware Diodes DESD5V0S1BB.
We providing 1 pdf manuals Diodes DESD5V0S1BB for download free by document types: User Manual






More products and manuals for Hardware Diodes

Models Document Type
DESD5V0S1BLD User Manual   Diodes DESD5V0S1BLD User Manual, 4 pages
DESD5V0S1BLP3 User Manual   Diodes DESD5V0S1BLP3 User Manual [en] , 4 pages
DLPT05W User Manual   Diodes DLPT05W User Manual [en] , 5 pages
DESDALC5LP User Manual   Diodes DESDALC5LP User Manual, 6 pages
DRTR5V0U1LP User Manual   Diodes DRTR5V0U1LP User Manual, 5 pages
DRTR5V0U1SO User Manual   Diodes DRTR5V0U1SO User Manual [en] , 4 pages
DRTR5V0U2SR User Manual   Diodes DRTR5V0U2SR User Manual, 4 pages
DRTR5V0U4S User Manual   Diodes DRTR5V0U4S User Manual [en] , 4 pages
DRTR5V0U4SL User Manual   Diodes DRTR5V0U4SL User Manual, 5 pages
DRTR5V0U4TS User Manual   Diodes DRTR5V0U4TS User Manual, 5 pages
DT1042-04SO User Manual   Diodes DT1042-04SO User Manual, 5 pages
DT1140-04LP User Manual   Diodes DT1140-04LP User Manual [en] , 5 pages
DT1452-02SO User Manual   Diodes DT1452-02SO User Manual [en] , 5 pages
DT1240-04LP User Manual   Diodes DT1240-04LP User Manual [en] , 5 pages
DT2042-04SO User Manual   Diodes DT2042-04SO User Manual [en] , 5 pages
DT2636-04S User Manual   Diodes DT2636-04S User Manual, 5 pages
DRDNB21D User Manual   Diodes DRDNB21D User Manual, 7 pages
DRD (xxxx) W User Manual   Diodes DRD (xxxx) W User Manual [en] , 9 pages
LMN200B01 User Manual   Diodes LMN200B01 User Manual [en] , 10 pages
LMN200B02 User Manual   Diodes LMN200B02 User Manual [en] , 10 pages