Anil
Anil

Reputation: 1765

Where to put css and javascript files in gradle java web application

I followed the steps for building java web application using the following guide https://guides.gradle.org/building-java-web-applications/

Now there is no web.xml generated. Trying to find out where to put my css and javascript files so that they can be accesible in jsp and html.

Upvotes: 1

Views: 1199

Answers (1)

Dusty
Dusty

Reputation: 81

Static resources should go in src/main/webapp. Anything in this folder will be copied into the root of the war file.

For Example, if you place the following index.html and site.css in src/main/webapp, you should get a page with Hello, World in blue text.

index.html

    <html>
    <head>
        <link href="site.css" />
    </head>
    <body>
        <h1>Hello, World</h1>
    </body>
    </html>

site.css

    h1 {
        color: blue;
    }

Upvotes: 3

Related Questions