Apple WebObjects 5 Uživatelský manuál Strana 39

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 108
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 38
CHAPTER 4
HTML-Based Applications
A Programmer’s View of WebObjects 39
Apple Computer, Inc. January 2002
Figure 4-1 The files of a WebObjects component
Dynamic Elements
The template file in Figure 4-1 looks like any other HTML file except for the element
with the <WEBOBJECT> tag. In this example, this tag represents a dynamic element.
Dynamic elements are the basic building blocks of a WebObjects HTML application.
They link an application’s behavior with the HTML page shown in the Web
browser, and their contents are defined at runtime. A dynamic element appears in
the template as a <WEBOBJECT> tag with a corresponding </WEBOBJECT> closing tag.
<HTML>
<HEAD><TITLE>Greeting</TITLE></HEAD>
<BODY>
Hello <WEBOBJECT NAME=String1></WEBOBJECT>!
<P></BODY>
</HTML>
import com.webobjects.appserver.*;
public class Greeting extends WOComponent {
protected String userName;
public Greeting(WOContext context) {
super(context);
}
public String userName() {
return userName;
}
public void setUserName(String newUserName) {
userName = newUserName;
}
}
String1 : WOString {
value = userName;
}
Component (Greeting.wo)
Template (Greeting.html)
Code (Greeting.java)
Bindings (Greeting.wod)
Zobrazit stránku 38
1 2 ... 34 35 36 37 38 39 40 41 42 43 44 ... 107 108

Komentáře k této Příručce

Žádné komentáře