Learn Java for Web Development

(Tina Meador) #1

174 CHAPTER 4: Building a Web Application Using Struts 2


The directory structure illustrated in Figure 4-8 follows the normal Maven directory structure.


Table 4-4 describes the directory structure of the HelloWorld application.


Table 4-4. Directory Structure of a Maven-Based Application
Directory Description
Src All source
: - main Main source directory
: : - java Java source
: : - helloworld Package defined by the groupID parameter
: : - action The package from the archetype
: :- resources Resources(configuration, properties, and so on)
: - webapp Web application files
: : - WEB-INF WEB-INF folder

Table 4-5. Directory Structure of a Non-Maven-Based Application
Directory Description

Src All source
: - helloworld Helloworld package
: - action Action package


  • struts.xml Resources(configuration, properties, and so on)
    Web Web application files
    : - WEB-INF WEB-INF folder


The directory structure of a non-Maven HelloWorld application might look like Table 4-5.


You need to add the struts 2-core dependency to the generated pom.xml file of the HelloWorld
application. Listing 4-13 shows the code fragment to add to pom.xml.


Listing 4-13. struts 2-core Dependency



org.apache.struts
struts 2-core
2.3.15.1
jar
compile
Free download pdf