import nextapp.echo.ContentPane;
import nextapp.echo.EchoInstance;
import nextapp.echo.Label;
import nextapp.echo.Window;
import nextapp.echoservlet.EchoServer;
public class HelloWorldServlet extends EchoServer {
// Returns a new user-instance of the Echo application.
public EchoInstance newInstance() {
return new HelloWorld();
}
}
class HelloWorld extends EchoInstance {
// This init method is called when a user first visits the
// application. It must return a Window object that will
// occupy the contents of the user's open browser window.
public Window init() {
// Create a new window.
Window window = new Window();
// Create a content pane. Components may not be added
// directly to a window, only to a content pane.
ContentPane content = new ContentPane();
// Set the window's content to be the content pane.
window.setContent(content);
// Create a new label that says "Hello, World!"
Label label = new Label("Hello, World!");
// Add the label to the content pane.
content.add(label);
// Return the new window.
return window;
}
} |