/* * This file is part of the Echo Web Application Framework (hereinafter "Echo"). * Copyright (C) 2002 NextApp, Inc. * * Echo is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Echo is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Echo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 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; } }