Where should I add servlets in the Eclipse IDE's new folder structure
Solution 1:
The "new" default folder structure, introduced in WTP 3.21 (Eclipse 2021-03, cf. release notes) follows Maven conventions, therefore:
- the folder
/src/main/java
is a source folder and contains Java sources. Here you should put your servlets. The contents of this folder are compiled into theWEB-INF/classes
folder of the WAR file, - the folder
/src/main/resources
contains files that need to be in the classpath, but are not compiled. This is also mapped into theWEB-INF/classes
folder of the WAR file, - the folder
/src/main/webapp
is the root folder of the WAR file (replaces the/WebContent
folder). Here (and in its subfolders) you'll usually put JSPs and static web resources.