Documentation

(vaadin)

Deployment Descriptor (web.xml)

The following XML is a minimalist deployment descriptor for applications using Vaadin UI.

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">
  <!--
 **************************************************************************
 Context configuration
 **************************************************************************
 -->
 
  <display-name>Simple Application</display-name>
 
  <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
 
  <context-param>
        <description>Vaadin production mode</description>
        <param-name>productionMode</param-name>
        <param-value>true</param-value>
  </context-param>
 
  <!--
 **************************************************************************
 WebUI configuration
 **************************************************************************
 -->
 
  <servlet>
    <servlet-name>VaadinUI</servlet-name>
    <servlet-class>com.sibvisions.rad.ui.vaadin.server.VaadinServlet</servlet-class>
    <init-param>
      <param-name>UI</param-name>
      <param-value>com.sibvisions.rad.ui.vaadin.impl.VaadinUI</param-value>
    </init-param>
    <init-param>
      <param-name>widgetset</param-name>
      <param-value>com.sibvisions.rad.ui.vaadin.ext.ui.Widgetset</param-value>
    </init-param>
    <init-param>
      <param-name>main</param-name>
      <param-value>com.sibvisions.apps.simpleapp.SimpleApplication</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/com/sibvisions/apps/simpleapp/application.xml</param-value>
    </init-param>
  </servlet>
 
  <servlet-mapping>
    <servlet-name>VaadinUI</servlet-name>
    <url-pattern>/ui/*</url-pattern>
  </servlet-mapping>
 
  <servlet-mapping>
    <servlet-name>VaadinUI</servlet-name>
    <url-pattern>/VAADIN/*</url-pattern>
  </servlet-mapping>

The application will be available via http://localhost/simpleapp/ui/.

If your Vaadin application should be available in context-root (http://localhost/simpleapp/), simply change the servlet mapping to:

  <servlet-mapping>
    <servlet-name>VaadinUI</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>
<!--
  <servlet-mapping>
    <servlet-name>VaadinUI</servlet-name>
    <url-pattern>/VAADIN/*</url-pattern>
  </servlet-mapping>
-->

Additional Options

There are some useful options that can be controlled via init parameters:

Push support (needs an application server with push support)

  <servlet>
    <servlet-name>VaadinUI</servlet-name>
    <servlet-class>com.sibvisions.rad.ui.vaadin.server.VaadinServlet</servlet-class>
 
    ...
 
    <init-param>
      <param-name>pushmode</param-name>
      <param-value>automatic | manual</param-value>
    </init-param>
    <init-param>
      <param-name>mobileView</param-name>
      <param-value>true | falsee</param-value>
    </init-param>
 
    <async-supported>true</async-supported>       
  </servlet>

Scale UI on mobile devices. This parameter adds <meta name=“viewport” content=“user-scalable=no,initial-scale=1.0” /> to the default index.html page, rendered from Vaadin.

    <init-param>
      <param-name>mobileView</param-name>
      <param-value>true | false</param-value>
    </init-param>

Use an external/additional CSS file. This is useful to override default CSS definitions without modifying the original Vaadin UI CSS file.

    <init-param>
      <param-name>externalCss</param-name>
      <param-value>../simpleapp.css</param-value>
    </init-param>

It's also possible to use resources from jar archives. Simply add: jar! as prefix.

If you want to use the same UI after pressing reload in your web browser, simply set the following:

    <init-param>
      <param-name>preserveOnRefresh</param-name>
      <param-value>true | false</param-value>
    </init-param>

UI redirection, e.g., from http://localhost/simpleapp/ to http://localhost/simpleapp/ui/

  <servlet>
    <servlet-name>UIRedirector</servlet-name>
    <servlet-class>com.sibvisions.rad.ui.vaadin.server.UIRedirectorServlet</servlet-class>
    <init-param>
      <param-name>redirectPath</param-name>
      <param-value>/ui/</param-value>
    </init-param>
  </servlet>
 
  <servlet-mapping>
    <servlet-name>UIRedirector</servlet-name>
    <url-pattern>/index.html</url-pattern>
  </servlet-mapping>
Only for Portlets

Use the following parameter to decide whether Vaadin libraries should be loaded from ROOT context (shared) or from application context.

    <init-param>
      <param-name>vaadin.shared</param-name>
      <param-value>true | false</param-value>
    </init-param>

It's possible to change the static file location, e.g., if you redirect http requests via mod_proxy or similar:

    <init-param>
      <param-name>vaadin.staticFileLocationPrefix</param-name>
      <param-value>/cust</param-value>
    </init-param>
ProjX

We have some special features in ProjX.

Use the following parameter to change the menu position.

    <init-param>
      <param-name>Application.Menu.position</param-name>
      <param-value>left | right</param-value>
    </init-param>

It's possible to hide the whole menu or toolbar.

    <init-param>
      <param-name>Application.Menu.visible</param-name>
      <param-value>true | false</param-value>
    </init-param>
 
    <init-param>
      <param-name>Application.Menu.ToolBar.visible</param-name>
      <param-value>true | false</param-value>
    </init-param>


Hint

It's also possible to use init parameters as URL parameter, e.g., http://localhost/simpleapp/ui/?Application.Menu.position=right .

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information