Home > OS >  Where should I add servlets in the Eclipse IDE's new folder structure
Where should I add servlets in the Eclipse IDE's new folder structure

Time:10-01

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:

  1. 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 the WEB-INF/classes folder of the WAR file,
  2. the folder /src/main/resources contains files that need to be in the classpath, but are not compiled. This is also mapped into the WEB-INF/classes folder of the WAR file,
  3. 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.
  • Related