Javascript files in vaadin project

Hi

Could you please tell me how to add custom javascript files into the project. I have got my html files in the Layout folder.
Where should I place the .js files?
And how do you reference it from the application?

Hello Clare,

here is an excellent article
https://vaadin.com/blog/-/blogs/vaadin-7-loves-javascript-components

Hi Wolfgang Wachsmuth

Thanks. But I included the @JavaScript({ “example.js” }) in my SearchView form which has a textfield
So in the textfield I have the following methods.
I want to invoke the showMessage function in my .js file.But it doesnt seem to have loaded in the application.

I have placed this in same location as the source file.

However it is not shown in the app/published directory

  addValueChangeListener(new ValueChangeListener() {
                @Override
                public void valueChange(
                        final com.vaadin.data.Property.ValueChangeEvent event) {
                    textChanged((String) event.getProperty().getValue());
                    Page.getCurrent().getJavaScript().execute("showmessage('" + this.getClass().toString() + "')");
                }
            });
        }
        
        private void textChanged(String text) {
            userContainer.removeContainerFilter(filter);
            if (text != null && !text.isEmpty()) {
                filter = new SimpleStringFilter(propertyId, text, true, false);
                userContainer.addContainerFilter(filter);
            }
        }