Project Folder Structure

Let’s create some necessary folders:

1.       src/main/java/com/itblogs/config/

2.       src/main/java/com/itblogs/controller/

3.       src/main/java/com/itblogs/dao/

4.       src/main/java/com/itblogs/dao/impl/

5.       src/main/java/com/itblogs/model/

6.       src/main/java/com/itblogs/service/

7.       src/main/java/com/itblogs/service/impl/

8.       src/main/java/com/itblogs/utils/

9.       src/main/resources/

10.   src/main/resources/messages/

11.   src/main/webapp/resources/css/

12.   src/main/webapp/resources/js/

13.   src/main/webapp/resources/img/

14.   src/main/webapp/WEB-INF/jsp/

15.   src/main/webapp/WEB-INF/lib/

16.   src/test/java/

 

 

Folder Structure:

Folder Details
src/main/java/com/itblogs/config/ Store Spring configuration files
src/main/java/com/itblogs/controller/ Controller Java classes
src/main/java/com/itblogs/service/ Service Manager Interface classes
src/main/java/com/itblogs/service/impl/ Service Manager classes implementing the interface
src/main/java/com/itblogs/dao/ DAO classes
src/main/java/com/itblogs/dao/impl/ DAO classes implementing the interface
src/main/java/com/itblogs/model/ Model classes
src/main/java/com/itblogs/utils/ Store any utilities Java classes here
src/main/resources/ Store log4j.properties file
src/main/resources/messages/ Store message property files
src/main/webapp/resources/css/ CSS files of the web page
src/main/webapp/resources/js/ JS files (such as JQuery and AngularJS) of the web page
src/main/webapp/resources/img/ Image files
src/main/webapp/WEB-INF/jsp/ JSP files
src/main/webapp/WEB-INF/lib/ Store necessary Jar libraries

Please note that you don’t need to copy the Jar files here. Maven will handle it, please see “do some checking for WEB-INF/lib” below.

src/test/java/ Store unit test Java classes

 

OK, let’s do some checking for WEB-INF/lib:

a. Check Deploy Path

Right-click the project => select “Properties” => click “Deployment Assembly”

Make sure “Maven Dependencies” is mapping to “WEB-INF/lib” Deploy Path

b. Check classpath.xml

Right-click classpath.xml, open with Text Editor, make sure it contains below settings:

<classpathentry kind=”con” path=”org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER”>

              <attributes>

                     <attribute name=”maven.pomderived” value=”true”/>

                     <attribute name=”org.eclipse.jst.component.dependency” value=”/WEB-INF/lib“/>

              </attributes>

</classpathentry>

c. Copy jstl-1.2.jar from Maven (C:\{your maven path}\.m2\repository\javax\servlet\jstl\1.2\jstl-1.2.jar) to WEB-INF/lib/

Why do we need to copy? “Deployment Assembly” should map the Maven dependencies to WEB-INF/lib . Yes, it has. But, under the pom.xml, we set jstl as <scope>provided</scope>. That’s mean you expect container providing the dependencies at runtime. So, jstl-1.2.jar need to copy to WEB-INF/lib/ .

Please rate this