Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Use one Vaadin project as UI in another in Eclipse
I'm still new to Vaadin and Java web development, so please forgive my ignorance...
I have two Vaadin projects side by side in Eclipse, and both run and compile fine on my Tomcat server. Now I would like to use the main UI of one project in a layout of the other project ... How do I do that? Simply adjusting the project path isn't enough - that way the classes are known only at design time, but not at runtime...
Thanks for any hints!
I see two options -
1) Deploy both your projects as different web applications, use iframe to embed one vaadin application inside another. Chk out custom layouts in vaadin
2) Make your second vaadin project as java project and move all your css and web-inf libs into main project. In eclipse deployment assembly of Vaadin project, add java project as dependency. This is more cleaner solution.
Thanks for your answer!
1) is out of question - since my second project needs authentication from my first project - if I need to deploy it as a standalone web app, I would need to reimplement the authentication also for the second web app.
2) This was also my thought - what I was trying to do is export my second project as a .jar and put it in the WEB-INF/lib of my first project ... however I might have missed something - how would I then use the second project's main class (extended from UI, let's call it SecondMainUI) in my first project?
SecondMainUI smain = new SecondMainUI();
won't work, I guess - and also by default the init function of SecondMainUI is protected ...
Thanks al lot,
Got it working!
What I did was write a function in my second project that encapsulates the init function and returns the layout as an output parameter. I can then add this layout to my main project. Here is the code (VaadinShellUI is the second project, TorrentmanagerUI is the main project, and I have a .jar with VaadinShellUI included in the web-inf/lib folder of TorrentmanagerUI):
VaadinShellUI vaadinShell = new VaadinShellUI();
VerticalLayout vaadinShellLayout = vaadinShell.extInit();
Still open to suggestions if someone has a more elegant solution!