1. Delete the file

    2. Create the WEB-INF folder inside the Web Pages folder

    3. Create the jsp, jspf and resources folders inside the WEB-INF folder

    4. Create the js and CSS folders inside the resources folder

    The new structure of the folders should look like this:

    Figure 43. Folder structure for the template-based project

    The WEB-INF/jsp folder will contain jsp pages and the jspf folder will contain page fragments that will be added to other pages using the following directive:

    Now, we modify the pom.xml file and add the general properties of the application, dependencies on library packages (Spring MVC, Jaybird, JDBC pool, JOOQ) and the properties of the JDBC connection.

    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <project xmlns="http://maven.apache.org/POM/4.0.0"
    3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    5. <modelVersion>4.0.0</modelVersion>
    6. <groupId>ru.ibase</groupId>
    7. <artifactId>fbjavaex</artifactId>
    8. <version>1.0-SNAPSHOT</version>
    9. <packaging>war</packaging>
    10. <name>Firebird Java Example</name>
    11. <properties>
    12. <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
    13. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    14. <spring.version>4.3.20.RELEASE</spring.version>
    15. <jackson.version>2.9.7</jackson.version>
    16. <jooq.version>3.9.2</jooq.version>
    17. <jstl.version>1.2</jstl.version>
    18. <javax.servlet.version>3.0.1</javax.servlet.version>
    19. <jaybird.version>3.0.5</jaybird.version>
    20. <db.url>jdbc:firebirdsql://localhost/examples</db.url>
    21. <db.driver>org.firebirdsql.jdbc.FBDriver</db.driver>
    22. <db.username>SYSDBA</db.username>
    23. <db.password>masterkey</db.password>
    24. </properties>
    25. <dependencies>
    26. <dependency>
    27. <groupId>javax</groupId>
    28. <artifactId>javaee-web-api</artifactId>
    29. <version>7.0</version>
    30. <scope>provided</scope>
    31. </dependency>
    32. <dependency>
    33. <groupId>javax.servlet</groupId>
    34. <artifactId>javax.servlet-api</artifactId>
    35. <version>${javax.servlet.version}</version>
    36. <scope>provided</scope>
    37. </dependency>
    38. <dependency>
    39. <groupId>jstl</groupId>
    40. <artifactId>jstl</artifactId>
    41. <version>${jstl.version}</version>
    42. </dependency>
    43. <!-- Working with JSON -->
    44. <dependency>
    45. <groupId>com.fasterxml.jackson.core</groupId>
    46. <artifactId>jackson-core</artifactId>
    47. <version>${jackson.version}</version>
    48. </dependency>
    49. <groupId>com.fasterxml.jackson.core</groupId>
    50. <artifactId>jackson-annotations</artifactId>
    51. <version>${jackson.version}</version>
    52. </dependency>
    53. <dependency>
    54. <groupId>com.fasterxml.jackson.core</groupId>
    55. <artifactId>jackson-databind</artifactId>
    56. </dependency>
    57. <!-- Spring -->
    58. <dependency>
    59. <groupId>org.springframework</groupId>
    60. <artifactId>spring-core</artifactId>
    61. <version>${spring.version}</version>
    62. </dependency>
    63. <dependency>
    64. <groupId>org.springframework</groupId>
    65. <artifactId>spring-web</artifactId>
    66. <version>${spring.version}</version>
    67. </dependency>
    68. <dependency>
    69. <groupId>org.springframework</groupId>
    70. <artifactId>spring-webmvc</artifactId>
    71. <version>${spring.version}</version>
    72. </dependency>
    73. <dependency>
    74. <groupId>org.springframework</groupId>
    75. <artifactId>spring-context</artifactId>
    76. <version>${spring.version}</version>
    77. </dependency>
    78. <dependency>
    79. <groupId>org.springframework</groupId>
    80. <artifactId>spring-jdbc</artifactId>
    81. <version>${spring.version}</version>
    82. </dependency>
    83. <!-- JDBC -->
    84. <dependency>
    85. <groupId>org.firebirdsql.jdbc</groupId>
    86. <artifactId>jaybird-jdk18</artifactId>
    87. <version>${jaybird.version}</version>
    88. </dependency>
    89. <!-- Connection pool -->
    90. <dependency>
    91. <groupId>commons-dbcp</groupId>
    92. <artifactId>commons-dbcp</artifactId>
    93. <version>1.4</version>
    94. </dependency>
    95. <!-- jOOQ -->
    96. <dependency>
    97. <groupId>org.jooq</groupId>
    98. <artifactId>jooq</artifactId>
    99. <version>${jooq.version}</version>
    100. </dependency>
    101. <dependency>
    102. <groupId>org.jooq</groupId>
    103. <artifactId>jooq-meta</artifactId>
    104. <version>${jooq.version}</version>
    105. </dependency>
    106. <dependency>
    107. <groupId>org.jooq</groupId>
    108. <version>${jooq.version}</version>
    109. </dependency>
    110. <!-- Testing -->
    111. <groupId>junit</groupId>
    112. <artifactId>junit</artifactId>
    113. <version>4.12</version>
    114. <type>jar</type>
    115. <scope>test</scope>
    116. </dependency>
    117. <dependency>
    118. <groupId>org.springframework</groupId>
    119. <artifactId>spring-test</artifactId>
    120. <version>${spring.version}</version>
    121. <scope>test</scope>
    122. </dependency>
    123. </dependencies>
    124. <build>
    125. <plugins>
    126. <plugin>
    127. <groupId>org.eclipse.jetty</groupId>
    128. <artifactId>jetty-maven-plugin</artifactId>
    129. <version>9.4.12.v20180830</version>
    130. </plugin>
    131. <plugin>
    132. <groupId>org.apache.maven.plugins</groupId>
    133. <artifactId>maven-compiler-plugin</artifactId>
    134. <version>3.8.0</version>
    135. <configuration>
    136. <source>1.8</source>
    137. <target>1.8</target>
    138. <compilerArguments>
    139. <endorseddirs>${endorsed.dir}</endorseddirs>
    140. </compilerArguments>
    141. </configuration>
    142. </plugin>
    143. <plugin>
    144. <groupId>org.apache.maven.plugins</groupId>
    145. <artifactId>maven-war-plugin</artifactId>
    146. <version>3.2.2</version>
    147. <configuration>
    148. <failOnMissingWebXml>false</failOnMissingWebXml>
    149. </configuration>
    150. </plugin>
    151. <plugin>
    152. <groupId>org.apache.maven.plugins</groupId>
    153. <artifactId>maven-dependency-plugin</artifactId>
    154. <version>3.1.1</version>
    155. <executions>
    156. <execution>
    157. <phase>validate</phase>
    158. <goals>
    159. <goal>copy</goal>
    160. </goals>
    161. <configuration>
    162. <outputDirectory>${endorsed.dir}</outputDirectory>
    163. <silent>true</silent>
    164. <artifactItems>
    165. <artifactItem>
    166. <groupId>javax</groupId>
    167. <artifactId>javaee-endorsed-api</artifactId>
    168. <version>7.0</version>
    169. <type>jar</type>
    170. </artifactItem>
    171. </artifactItems>
    172. </configuration>
    173. </execution>
    174. </executions>
    175. </plugin>
    176. </plugins>

    After all the necessary dependencies have been fulfilled, a reload of the POM is recommended, to load all the necessary libraries and avoid errors that might otherwise occur while you are working on the project. This is how it is done in NetBeans:

    fbdevgd30 java 002 en