可通过maven archetype工具构建helloworld。
其他相应配置:
1、maven pom配置:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>6.7.8</version>
<scope>compile</scope>
</dependency>
2、web.xml配置:
<?xml version = "1.0" encoding = "UTF-8" ?>
<web-app
id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Alan's Vaadin Example</display-name>
<context-param>
<description>Vaadin production mode</description>
<param-name>productionMode</param-name>
<param-value>false</param-value>
</context-param>
<servlet>
<servlet-name>My Application</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>com.alan.myvaadin.main.MyVaadin</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>My Application</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
3、Vaadin application入口:
public class MyApplication extends Application {
Button b_model,b_add;
Window main = new Window("The Main Window");
@Override
public void init() {
b_model = new Button("Open module");
main.addComponent(b_model);
b_model.addListener(Button.ClickEvent.class, this, "open");
setMainWindow(main);
}
public void open(Button.ClickEvent event){
api ap = new Handle();
String room = ap.getRoom();
b_add = new Button(room);
main.addComponent(b_add);
}
}