Integrate Vaadin web app and jsp web app in the same war file

HI guys.
I’ve just started using Vaadin framework, and just a web-develop beginner , it certainly is awesome. However, I get a problem now.
I have a web app written by using Vaadin framework (Activiti Explorer in detail) , and another using struts2.
My problem is to integrate two app in the same war file, I have source code of both those app. There isn’t any clue.
Someone give me some advises, please.

You cannot package different webbapps in one war-file. I think you should try it with the

Actually, it is possible to have multiple servlets corresponding to multiple applications in a WAR, you just need to combine the web.xml files correctly to map each servlet to the correct paths etc. if you are not using Servlet 3.0 specification annotations (@WebServlet etc.) to configure the servlets. Some limitations apply, e.g. the applications in a WAR share the same session and classloaders.

Then again, it might make more sense to keep them separate with an EAR so you skip the effort of combining the applications and maintaining the combined version.

Thanks for your advises, guys . I had spending time to try some methods.

I just try things like that: copy all source of two apps into one project, try run project using file web.xml of each app respectively, it’s OK.
However, when I combine file xml - simply copy all content into one file, no complier error, then I can only see Actitivi-Explorer, no clue about another :frowning:

I want to run my struts apps first, if possible, I want to return a jsp page or using java class to call Vaadin app. Which method I can use?

I would recommend reading some more about the structure of web.xml and especially about servlet mappings if you are not familiar with them - they are not specific to Vaadin (though note the bit about “/VAADIN” below).

At least two possible issues come to my mind, though.

Firstly, you probably map both applications to the same path if you didn’t update servlet mappings by hand when merging the files. Only one application can be mapped to the root path (“/") and the other needs to be mapped to some sub-path of it. On the other hand, if you map the Vaadin application to some other path, you also need to map "/VAADIN/” to the same Vaadin servlet that you use for the application - see e.g. the Book of Vaadin if you need examples on this.

Furthermore, some servers are sensitive about the order of the sections and tags in the web.xml file so you might need to group similar sections. Many servers don’t care too much about this, though.