Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing a web application's static resources

I've just built a very simple Java web application using the Wicked framework. The current layout of the project is:

src/
    main/
        java/
            net/myapp/
                Homepage.java
                Homepage.html
        reources/
            scripts/
                script.js

In the Homepage.html file I am trying to load the JavaScript file:

<script src="scripts/script.js"></script>

I deployed the application, but the browser doesn't find the JavaScript file.

The WAR file is being packaged using the maven-war-plugin. I looked into the WAR file, and I see the following layout:

WEB-INF/
    classes/
        net/myapp/
            Homepage.class
            Homepage.html
        scripts/
            script.js

What am I doing wrong? What am I missing?

like image 834
Mario Duarte Avatar asked Dec 10 '22 09:12

Mario Duarte


1 Answers

The web-related resources should be placed in src/main/webapp

like image 191
Bozho Avatar answered Dec 29 '22 18:12

Bozho