Can I use .jsp file instead of .html in CustomLayout

Can I use .jsp file instead of .html in CustomLayout or add (jsp code in .html file)

Have you tried it? :slight_smile:

My guess is that you
, but it won’t do what I think you’re trying to do. I’ve only used the CustomLayout constructor that takes an input stream, and so I imagine the layout template will be written out by the Vaadin runtime and not interpreted by the servlet container.

Short pause…

Ok, I tried it, and I don’t see the JSP being interpreted as anything but static xhtml. I put this into my layout template:

    Test. <c:out value="${ 2 + 2 }" /> Did that work?

…and my output has the text but not the number 4 in the middle. I suppose Vaadin could add a constructor for CustomLayout that takes a URL to the template and fetches it in a separate request to the server before parsing it and returning it to the client. That would be a little slower, but conceivably would work (you could file an RFE).

But, instead, you can always add more dynamic content to the page by adding more Vaadin bits to the template.


The problem with this is that JSP is not interpreted at run time by the server, but compiled into a Java servlet class when first requested. Any JSP requests need to be dispatched directly to this special servlet.

If you need to mix JSP and Vaadin code extensively - instead of e.g. running a Vaadin application in an iframe inside the JSP application - you can take a look e.g. at
this thread
and the ExternalLayout add-on mentioned in it. The idea there is to let the JSP servlet generate the page, but so that it includes the Vaadin client side engine start-up code, which then places Vaadin components at placeholder divs on the JSP page.