Where do CSS and JavaScript files go in a Maven web app project?

前端 未结 5 1579
余生分开走
余生分开走 2020-12-02 07:40

I am switching to use Maven for my Spring web app projects and I am running into a simple issue. I am not sure where to put the CSS and JS files in the new project structure

5条回答
  •  無奈伤痛
    2020-12-02 08:07

    I was faced with the same question in a maven project. There seems to be no good answer to my problem. So I did a simple experiment and it worked perfectly.

    This is a simple maven project, I have the following directory structure: (Irrelevant directories are not shown)

    ───src
       └───main
           ├───java
           ├───resources
           └───webapp
               ├───javascript
               │   ├───test.js
               │   ├───example.js
               │   └───jquery-library.js
               ├───WEB-INF
               │    └───web.xml
               └───example.jsp
    

    My JSP pages can refer to my javascript libraries simply as

    
    

    There is no need for any special configuration.

提交回复
热议问题