Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Configuration of web.xml for multiple applications
I want to deploy Vaadin together with other applications in one WAR file.
So I put into my web.xml
<url-pattern>/app/*</url-pattern>
instead of
<url-pattern>/*</url-pattern>
but then got the error message:
Failed to load the widgetset: /TCF/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js?1269987606793
Is there a way that the Vaadin application can be run like I would?
The other possbility I see is to tell vaadin it should treat some URLs specially like it seems to handle the themes stuff right now. How is this actually done and can it somehow be influenced?
Thanks in advance,
Thomas
Also add /VAADIN/* mapping to the application (widgetset and themes are loaded from /VAADIN/*
Could you submit the full web.xml file? I have multiple servlets in my application and they work together without any problems
Sorry, I was busy with another task.
Your suggestion worked fine, thanks.
Regards,
Thomas
Hi,
I'm new in vaadin, but now I'm trying to add multiple applications to one vaadin app.
Could you submit yout full web.xml file?
Now I have something like that: and it doesn't work
<servlet>
<servlet-name>DQApplication</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<init-param>
<!-- Define our application class for servlet. -->
<param-name>application</param-name>
<param-value>ui.main.DQMainView</param-value>
</init-param>
<init-param>
<param-name>widgetset</param-name>
<param-value>dwapplication.DqapplicationWidgetset</param-value>
<description>Application widgetset</description>
</init-param>
</servlet>
<servlet>
<servlet-name>DQ2</servlet-name>
<display-name>DQ2</display-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>dwapplication.DwhApplication</param-value>
</init-param>
<init-param>
<param-name>widgetset</param-name>
<param-value>dwapplication.DqapplicationWidgetset</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>DQApplication</servlet-name>
<url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DQ2</servlet-name>
<url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>
You need to map the two applications to different url patterns -- the web server needs to know when to call one or the other. See this example for several applications.
Thanks for your reply.
I think that you say about two different applications. I think about two different classes in one project which extends Application.
I have one project, where I have one class which is responsible for logging users:
public class LoginApp extends Application {
....
}
and the second one in other package which is main view of my application:
public class DQMainView extends Application implements ActionListener,
ClickListener, ValueChangeListener, ItemClickListener,
TransactionListener {
...
}
And I would like to set LoginApp as first view of my application. And I'd like to have another URL to DQMainView .
Is it possible? I did what you said and it doesn't work.
web.xml:
<servlet>
<servlet-name>DQApplication</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<init-param>
<!-- Define our application class for servlet. -->
<param-name>application</param-name>
<param-value>ui.main.DQMainView</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>DwhApplication</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<init-param>
<!-- Define our application class for servlet. -->
<param-name>application</param-name>
<param-value>dwhapplication.DwhApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>DQApplication</servlet-name>
<url-pattern>/d/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DwhApplication</servlet-name>
<url-pattern>/a/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DQApplication</servlet-name>
<url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>
I think you said it yourself:
the second (class) in other package which is main view of my application
I.e. it is much easier if you approach this as having a single application, and simply switching views.
In a typical scenario, your application would check if the user is logged in, and if not, display a login page with a login form (there is a LoginForm component for that purpose). You would register a LoginForm.LoginListener on your form, so that you get an event on form submission. The event handler would check the username/password and if correct, *replace* the content of the main window to become the home page for your application.
There are other variations. You could have a single home page and have the login form show as a pop-up; on successful login the listener would register the application user information, hide the login form, and update some components of the page (for example, to enable additional menus, show the user name, etc.)