Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
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.
Regards,
Arvind.
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]\"></script>");
String javascript =
"<script type=\"text/JavaScript\">"+
[here you put the javascript you want to add]
"</script>";
page.append(javascript);
super.writeAjaxPageHtmlHeader(page, title, themeUri, request);
}
I hope this will help :).