I’ve just uploaded a new Vaadin add-on:
JSP Integration . It’s basically a tag library for JSP views that allows you to easily render a VaadinUI in a JSP file:
Hi Alejandro,
very nice. With your addon you get rid of rather ugly javascript includes as described within the vaadin-book.
There is however one minor point with your pom: the versions of the servlet-api and jsp-api artifacts must be upgraded in order to avoid jsp-compilation error: “The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory” see:
https://stackoverflow.com/questions/7064269/the-method-getjspapplicationcontextservletcontext-is-undefined-for-the-type-js
Thanks for the feedback! I wanted to use early versions for this kind of dependencies so that it’s compatible with existing JSP applications that may be using old versions of these libraries. But you made a good point. I forgot to use
provided scope for those dependencies. I just uploaded a new version of the add-on (1.1). Thanks again!
Hi Alejandro,
Thanks for your fast reply! I combined your addon with the ExternalLayout addon. This is most valuable in cases where you have multiple places in the jsp, where you want to insert Vaadin components. In the end my UI contains a CssLayout, which itself contains only the Vaadin components to be inserted in the JSP. Very nice!
Again many thanks, El Goog
Hi Alejandro,
i have extended your tag by a further optional parameter ‘parameters’. When used, the value should contain an ampersand separated sequence of name=value pairs. The tag handler puts corresponding attributes into the HtmlSession. The started UI can fetch these attributes from the WrappedSession. This works fine.
My question: is there a better solution for passing parameters to the embedded UI? I want to replace applets in JSPs by a Vaadin UI and pass the applet parameters to the UI.
i have extended your tag with a further optional parameter ‘parmns’. If this parameter is given, it serves as a namespace for the attribute names given in the parameter ‘parameters’. Moreover it may be used to pass different sets of parameters in multiple calls of the same UI.
For example:
<vaadin:ui url="/vaadindialogs" theme="vaadindialogs" parmns="vaadin.dialogs.abc." parameters="x=y&z=1" />
will result in:
setAttribute("vaadin.dialogs.abc.x", "y");
setAttribute("vaadin.dialogs.abc.z", "1");
The tag description in the tld file is:
[code]
ui
org.vaadin.jsp.VaadinTagHandler
empty
Renders a Vaadin UI
<attribute>
<name>url</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
<description>URL mapped to the Vaadin Servlet</description>
</attribute>
<attribute>
<name>theme</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
<description>Vaadin theme name</description>
</attribute>
<attribute>
<name>widgetset</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
<description>Widgetset name</description>
</attribute>
<attribute>
<name>vaadindir</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
<description>Widgetset name</description>
</attribute>
<attribute>
<name>parmns</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
<description>Namespace for the names within parameters, i.e. the Session-Attribute will be: parmns+name</description>
</attribute>
<attribute>
<name>parameters</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
<description>name=value-Pairs separated by ampersand; each pair will be saved in HttpSession</description>
</attribute>