+1  A: 

In Eclipse, if you are using the Java Web Development view, you'll have configured:

  1. A Tomcat Server runtime that provides the servlet libraries
  2. A Java Runtime
  3. Other required libraries

The Web App Libraries that are in the project duplicate the first setting, so that you don't need a local Tomcat installed on the development box.

The rest sounds messy to me.

You have your src / JavaSource folder with the raw Java files in it. They shouldn't be in Web Content - that's for your HTML, images, JSPs, etc.

So a typical project setup:

Project Name/
   JavaSource/ or src/ // holds all the Java Source Files, Servlets, Struts Actions
   WebContent/         // Nice root folder to hold web content files
       content files and folders
       WEB-INF/        // Web App Config folder
           lib/        // Libraries (but not tomcat ones)
           web.xml
           classes/    // Where your compiled Java goes, and configs (log4j.properties)

Some people put the JSP inside WEB-INF too, as it isn't required to be accessible in the JSP file state, only in the compiled state that Tomcat does itself.

JeeBee
A: 

Its simple, eclipse provides multiple view to your project structure. The view you are looking at is definitely the Package Explorer view. In that view, everything that has a special icon in front is a helper item which is there to help you out by simplifying access to certain stuff like external libraries (which are provided by software on your computer or eclipse itself or other project).

In eclipse, go to menu->window->show view->navigator The Navigator view will tell you the real folder structure of your project.

Loki
+2  A: 

Web App Libraries isn't a real directory, but rather a listing of what Eclipse thinks are this project's libraries.

Generally, this consists of all the jar files in WebContent/WEB-INF/lib/

Sometimes, Eclipse no longer lists them in their real directory in Eclipse's Package Explorer... but they're still there if you look with another program.

R. Bemrose
But what is it used for? Can you do without it?
Vidar
+1  A: 

I assume this is a screenshot from the 'Project Explorer' view. It does not display exact folders and files structure, is adds a few candy constructed from project's metadata.

  • To see real structure of your project, try switching to the 'Navigator' view.
  • During a WAR file import, Eclipse basically does two things:
    • Creates a new web project and copies WAR's content to 'WebContent' subfolder of the new project.
    • Based on the WAR, it constructs project's metadata (.project and .classpath files).
  • The 'Web App Libraries' section displays list of jar files that the WAR contained (in WEB-INF/lib
  • 'Imported classes' (which I also see for a first time) seem to contain classes found in the imported WAR (WEB-INF/classes), for which Eclipse was not able to find any corresponding source files. To fix this, create a new Java source folder in the project and move the classes you now have in 'firstResource' folder to it.
david a.