In Vaadin 7, how do I reference a JavaScript file using @JavaScript
annotation? I have @com.vaadin.annotations.JavaScript("tawkToWebChat.js")
in my UI code, which puts <script type="text/javascript" src="./APP/PUBLISHED/tawkToWebChat.js"></script>
in the <head>
section, and I put the JavaScript file in resources\com\mobiwms\website
, since my UI class is in the com.mobiwms.website
package. Is that the correct place to put the JavaScript?
Also, my tool really needs to be added at the end of the <body>
section - how would I do that?
My only goal is to add a plugin to my website, which will be a webChat customers can use to talk to our support staff. Sometimes such plugins need to be added to <head>
, other times to <body>
, just need to know how to do both, and thought @JavaScript
annotation would be the way to do it.
As per [this blog post]
(https://vaadin.com/blog/vaadin-7-loves-javascript-components), I even tried copying the script to the same exact package as my Java file.