I'm new to dynamic web designing using java. In the reference video I'm following the professor is using an older version of eclipse IDE. My folder structure is a bit different from his. I'm using tomcat version 9 and I'm supposed to use MVC architecture. Can someone please let me know where should I save the servlets in the new folder structure? I'm using the following version of the Eclipse IDE. Version: 2021-09 (4.21.0) The image attached to this contains my folder structure.
CodePudding user response:
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.