The Hello World program that runs as a portlet is no different from a regular Vaadin application, as long as it doesn't need to handle portlet actions, mode changes, and so on.
import com.vaadin.Application; import com.vaadin.ui.*; public class PortletExample extends Application { @Override public void init() { Window mainWindow = new Window("Portlet Example"); Label label = new Label("Hello Vaadin user"); mainWindow.addComponent(label); setMainWindow(mainWindow); } }
In addition to the application class, you need the descriptor files, libraries, and other files as described earlier. Figure 13.2, “Portlet Project Structure in Eclipse” shows the complete project structure under Eclipse.
Installed as a portlet in Liferay from the Add Application menu, the application will show as illustrated in Figure 13.3, “Hello World Portlet”.