The W4T Eclipse feature contains an example application that demonstrates many of the features of W4 Toolkit and W4T Eclipse. The example application, along with its complete source code, is included in W4T Eclipse as a packaged Eclipse project.
This document describes how to:
import the example application project into your workspace.
work with the example application in W4T Eclipse.
deploy the example application to an application server.
Installing the example application
The example application comes as a complete W4 Toolkit project which can be imported easily into your workspace:
Open the New project wizard, either by right-clicking into the Navigator or Package Explorer window and selecting New > Project from the context menu (this is what you see on the image below), or by choosing New > Project from the File menu.
In the left part of the New project wizard, there is a category named Examples, which includes an entry for the W4T Eclipse example application.
Press Next and Finish.
There is a new W4 Toolkit project now in your workspace which contains the sources, libraries and all settings you need to start the example application.
Running the example application
You can run (and also debug, as with every Java program) the example application right from the Eclipse project:
Open the W4T Eclipse perspective (if you not already did) from the Menu Window > Open Perspective.
Browse through the sources of the example application, which are contained
in the folder named src. The gui elements that are editable with W4T Eclipse
reside in the package
You can open any of the classes in this package with the visual designer: they are subclasses of either com.w4t.WebForm or com.w4t.WebPanel. Both are containers and therefore visually editable. Simply right-click on the source file and select Open with > W4T Eclipse. Switch the editor to the Designer tab for visual development.
In the preferences (menu Window > Preferences) choose the entry for W4 Toolkit > W4WARP. This is the name of the internal server W4T Eclipse uses for launching and debugging. You have to set a path to the external browser on your system:
(Possibly - but not very likely - you also need to change the ports for the HTTP sockets, if the default ports are already assigned.)
To run the example application, select the
LoginForm class and
open it with W4T Eclipse. Now go to the menu Run,
select Run As ... > W4 Toolkit Application.
A new window of the external browser opens and the login form of the
example application should be opened within it.
Deploying the example application
The example application is a web application which has the necessary
directory structure to simply package it into a web application archive
.war-file) and deploy it to any application server that complies
to the Java Servlet specification 2.2. or higher.
There is an export wizard that simplifies this task even more for you.
Right-click the project and select Export from the popup menu:
Select WAR file (W4 Toolkit) from the list:
Select the checkbox of the example project and specify a name for the
.war archive that will be generated.
Specify whether you want classes only or classes and sources to be exported.
Enter the startup form name for the application. For the example,
this is the only configuration setting you need. The startup form is
the fully qualified class name of a
WebForm. In the example,
the best choice happens to be
com.mycomp.gui.LoginForm, the name of
the login form.
(When you run the deployment wizard for the first time, it asks you for permission to create a temporary directory. Hit OK here.)
.war archive has been created now. Deploy it to your
application server (e.g. copy it to the
if you use Tomcat).
Enjoy and start planning your next web application :-)
Copyright (c) 2003 by Innoopract Informationssysteme GmbH. All rights reserved.