question regarding integrating a js based library into a java web app

I want to integrate the JS based code editor named “Code Mirror” into a Vaadin based UI

There is already an addon which integrates a much older version of Code Mirror into Vaadin- Code Mirror v0.8 is integrated into Vaadin in that addon- Can someone tell me how to go about integrating Code Mirror (a JS library) into a vaadin app? I want to integrate the latest version of code mirror into a vaadin app.

Any help would be appreciated.


Hi Arvend,
you just have to create your own servlet which extends AbstractApplicationServlet and override the writeAjaxPageHtmlHeader method.
here’s an example:

protected void writeAjaxPageHtmlHeader(BufferedWriter page, String title, String themeUri,
            HttpServletRequest request) throws IOException {
        page.append("<script type=\"text/JavaScript\" src=\"[here you put the path to code mirror lib]
         String javascript =
                  "<script type=\"text/JavaScript\">"+
                 [here you put the javascript you want to add]

        super.writeAjaxPageHtmlHeader(page, title, themeUri, request);


I hope this will help :).