Hi, I am new to Vaadin. I tried searching the forum but I can’t seem to find what I am looking for.
I am new to programming and We have an existing project created using only JSP pages. There will be an enhancement on the project and I want to use vaadin in the enhancement. So I added the Vaadin library and web.xml attributes needed to the same project. However, when I tried to call the page from within the vaadin application, It will not display the page but instead it will only display my vaadin main window. I also try to run on server the existing page but it also redirects to the vaadin main window. Anything I need to do to add vaadin in my application and for me to call my existing pages created using JSP from within the vaadin application?
Not sure what the problem actually is, couldn’t quite follow your description, sorry. But it sounds a little bit like the Vaadin-servlet reacting on the content-root of your application and therefore there is a conflict between the JSPs and the Vaadin-servlet. Maybe you can show a little code and describe your setup?
I have an existing application before named myApp. When I haven’t integrated vaadin to it I can easily call any pages from my application using the URL like
From within vaadin window I have this Link that calls the myJSPPage.jsp. But instead of going to my existing application myJSPPage, it will only still display my existing main window but the url has been changed to this:
public class SVNInstallerPanel extends Panel {
public SVNInstallerPanel(URL url){
super(“SVN Installer”);
this.addStyleName(“AutosysSvnPanel”);
//AddAutosysButton addButton = new AddAutosysButton(this,url);
Link link = new Link(“SVN Installer”,
new ExternalResource(url+“myApp/myJSPPage.jsp”));
link.addStyleName(“svnInstallerLink”);
link.setIcon(new ThemeResource(“images/svnInstaller.png”));
this.addComponent(link);
this.setHeight(100, Sizeable.UNITS_PERCENTAGE);
}
}
Do I need to add something in the web.xml file to solve this issue? Thank you very much!
Well, I don’t have any experience with Vaadin inside a JSP-application, but I think your Vaadin-Servlet-Mapping in the web.xml is probably wrong, or rather a bit too loose. I guess you re using some wildcard-mapping like “/", which would simply match any URL underneath your Context-Root. Try to tighten that a bit by matching only a single URL underneath your Context-Root, for example “/myVaadinApp”. Remember that you then most probably also need an URL-matching for the widgetset-resources in "VAADIN/”.
Unfortunately, there’s no way in Java EE right now to specify a URL pattern with
excluded URLs. That would be very useful when you want to map /* to an application but have some other directory like /static/* not get mapped to it (Tomcat has a built in servlet I think for this kind of thing, but it’s not as general as my idea of having excluded url patterns).
I just had to do something similar with my application, running at /*, and needed to include a servlet at another URL that forwards to a JSP that I keep in WEB-INF/jsps. It’s all fairly straightforward, but not obvious. Like many things, I’ve been meaning to blog about it.
Thanks Everyone. Actually, I just got back to this post, but I already saw another forum stating that web.xml mapping needs to be changed as suspected. Thank you again for your answers!
Two years later, this was helpful. I wrote a nice Vaadin app, and then my boss wanted me to throw the company login page on it: a JSP. I struggled for a whole day in trying to integrate a JSP login page with Spring Security and Spring-MVC (controller to take the login and check against database and then redirect to launch the Vaadin app). I ready many forum and blog posts with only obliquely illuminating tips. I was plagued with redirect loops, 404s, etc. As Mr. Bissett said, the solution was not obvious to me but it turned out to be straightforward. One of the most befuddled moments in my eight years of programming.
I ended up doing this in Spring context-security.xml: