0

I am following this guide's structure.

I have added a script.js file (currently placed in the templates directory). This script.js is referenced from one of my html files, however when i start my application the script.js is not being found successfully.

From what i'm seeing i think you need to @Grab it somehow? Not sure.

How can i make it that my script.js file is discoverable?


Edit:

Here is a quicker view of my structure

  • src
    • My.java
  • templates
    • greeting.html
    • script.js
  • app.groovy

greeting.html contains <script src="script.js" /> however it is not being loaded

1 Answer 1

2

Per the user guide: if the resource is static you could try putting static content in one of the standard locations (e.g. classpath:static/ or classpath:public/).

If you need it to be a template (not sure thymeleaf can handle that easily) then you would have to change the view resolver configuration, but my guess is that's not the problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.