Apple WebObjects 3.5 Instrukcja Użytkownika Strona 54

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 218
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 53
Chapter 3 Common Methods
54
appendToResponse:inContext: method adds bold and italic markup elements around a
string’s value as follows:
id value;
id escapeHTML;
id isBold;
id isItalic;
- appendToResponse:aResponse inContext:aContext
{
id aString = [value description];
[super appendToResponse:aResponse inContext:aContext];
[aResponse appendContentHTMLAttributeValue:@"<p>"];
if (isBold) {
[aResponse appendContentHTMLAttributeValue:@"<b>"];
}
if (isItalic) {
[aResponse appendContentHTMLAttributeValue:@"<i>"];
}
if (escapeHTML) {
[aResponse appendContentString:aString];
} else {
[aResponse appendContentHTMLString:aString];
}
if (isItalic) {
[aResponse appendContentHTMLAttributeValue:@"</i>"];
}
if (isBold) {
[aResponse appendContentHTMLAttributeValue:@"</b>"];
}
}
After you invoke super’s appendToResponse:inContext:, the application generates the
response page. At this point you could do something appropriate for the end of
the request. For example, the following implementation terminates the current
session:
public void appendToResponse(response, context) {
super.appendToResponse(response, context);
session().terminate();
}
For more details on each phase of the request-response loop, read the chapter
“WebObjects Viewed Through Its Classes” (page 63).
Przeglądanie stron 53
1 2 ... 49 50 51 52 53 54 55 56 57 58 59 ... 217 218

Komentarze do niniejszej Instrukcji

Brak uwag