More Tutorials| Bioinformatics| Open Source| Photoshop| Questions? | Software Development
 

Opening a new window in Echo3

In this example of Echo3 (server-side application) we will create a new Window. To create this example we have created two class files WindowServlet.java and WindowApp.java.

Opening a new window in Echo3

                         

In this example of Echo3 (server-side application) we will create a new Window. To create this example we have created two class files WindowServlet.java and WindowApp.java. WindowApp.java is responsible for creating the application user interface through which the user will interact. WindowApp class extends the abstract class ApplicationInstance 

The init() method is used to initialize the state of the user interface for a user. It must return an Echo Window object representing the state of the initial window of an application. Here we have created a new Window by constructing the object of WindowPane. Further we have created the class WindowServlet which extends the WebContainerServlet for handling HTTP request to the servlet. WindowServlet will call the WindowApp class. Here is the full source code of WindowServlet and WindowApp as follows:

 

 

 

WindowServlet.java

package window;

import nextapp.echo.app.ApplicationInstance;
import nextapp.echo.webcontainer.WebContainerServlet;

public class WindowServlet extends WebContainerServlet {

    public ApplicationInstance newApplicationInstance() {
        return new WindowApp();
    }
}

WindowApp.java

package window;

import nextapp.echo.app.ApplicationInstance;
import nextapp.echo.app.ContentPane;
import nextapp.echo.app.Label;
import nextapp.echo.app.Window;
import nextapp.echo.app.*;


import nextapp.echo.app.event.ActionListener;
import nextapp.echo.app.event.ActionEvent;

public class WindowApp extends ApplicationInstance {

 private WindowPane windowPane;

    public Window init() {
        Window window = new Window();
    window.setTitle("Window1");
    ContentPane contentPane = new ContentPane();
        Label label=new Label("Window Example");
    windowPane = new WindowPane();
    windowPane.setTitle("Window");
    windowPane.add(new Label("New Window"));
    contentPane.add(windowPane);
    window.setContent(contentPane);
        return window;
    }  

Do the servlet entry and servlet mapping into the deployment descriptor file web.xml

<!DOCTYPE web-app 
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<display-name>Interactive Test Application</display-name>
<description>
         An interactive application to test features of the Echo Platform.
</description>

<servlet>
<servlet-name>WindowServlet</servlet-name>
<servlet-class>window.WindowServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>WindowServlet</servlet-name>
<url-pattern>/winapp</url-pattern>
</servlet-mapping>

</web-app>

Output :

Type the following URL into the address bar http://localhost:8080/echo3/winapp 

Download Source Project

                         

» View all related tutorials
Related Tags: c web api file ide files server framework application jar io tutorial ria id server-side tar app create echo frame

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
 
Tell A Friend
Your Friend Name

 

 
Recently Viewed
Software Solutions
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.