When we use Spring and Maven, where should we put the files? in the webapp folder or in the WebContent folder?
When we use Spring and Maven, where should we put the files? in the webapp folder or in the WebContent folder?
Each IDE / Build Tool has its own way of structuring a Java project, some are more rigid, others more flexible. The folders that you mentioned will not be present in the same project, since they are part of the structure of different IDEs / Build Tools .
The WebContent
folder exists in Eclipse projects of type Dynamic Web Project .
The webapp
folder is part of the Standard Directory Layout (as Maven has become popular, some other tools have adopted a similar structure, such as Gradle).
As your project is a Maven Web Project , you should use the webapp
folder which, according to the Maven documentation, is where you should go to files like your JSP pages, web.xml
etc.
It depends a lot on which files. A clear example is that properties files for example stay in the resource folder. On the other hand, the java files are placed in their package structure, and from there it is possible to define which packages store models, repository and even view.
If you use thymeleaf for example, there is a specific configuration to make in the xml configuration file of the same where you can define where and what the structure of the file. In the documentation it is possible to find the form. Look for the spring version, I believe there will be a clear definition.
I could give you an example but there are several versions. Put a version of spring and mavem and I can even post a basic example (skeleton).
Good afternoon, my friend, Here's where I work, we put all Frontend-related code (Javascript, Html, Css, Jquery ..) into WebContent (responsive), where there are organizational subfolders (View, Model, Collection and template) ... I hope I have helped.