Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
book-of-vaadin.pdf
Скачиваний:
88
Добавлен:
24.03.2015
Размер:
13.43 Mб
Скачать

Getting Started with Vaadin

Create project template

Make the wizard create an application class stub.

Application Name

A name for the servlet or portlet.

Base package name

The name of the Java package under which the UI class of the application is to be placed.

Application/UI class name

The name of the UI class for the application, in which the user interface is developed.

Portlet version

When a portlet version is selected (only Portlet 2.0 is supported), the wizard will create the files needed for running the application in a portal. See Chapter 12, Portal Integration for more information on portlets.

Finally, click Finish to create the project.

2.5.2. Exploring the Project

After the New Project wizard exists, it has done all the work for us: an UI class skeleton has been written to src directory and the WebContent/WEB-INF/web.xml contains a deployment descriptor. The project hierarchy shown in the Project Explorer is shown in Figure 2.3, “A New Vaadin Project”.

The Vaadin libraries and other dependencies are managed by Ivy. Notice that the libraries are not stored under the project folder, even though they are listed in the Java Resources Libraries

ivy.xml virtual folder.

The UI Class

The UI class created by the plugin contains the following code:

package com.example.myproject;

import com.vaadin.server.VaadinRequest; import com.vaadin.ui.Label;

import com.vaadin.ui.UI;

public class MyprojectUI extends UI { @Override

public void init(VaadinRequest request) {

// Create the content root layout for the UI VerticalLayout content = new VerticalLayout(); setContent(content);

Label label = new Label("Hello Vaadin user"); content.addComponent(label);

}

}

Deployment Descriptor (web.xml)

The deployment descriptor WebContent/WEB-INF/web.xml defines Vaadin framework servlet, the application class, and servlet mapping. Below is a deployment descriptor for the Hello World application.

Exploring the Project

41

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]