官术网_书友最值得收藏!

Creating a project and setting up Maven dependencies

We will perform the following steps to create the Maven project for our application:

  1. Create a Maven web project as described in Chapter 2, Creating a Simple JEE Web Application.
  2. Name the project CourseManagementJDBC.
  3. Add dependencies for servlet and JSP, but do not add a dependency for JSF.
  1. To add the dependency for JSTL, open pom.xml and go to the Dependencies tab. Click on the Add... button. Type javax.servlet in the search box and select jstl:

Figure 4.10: Adding a dependency for jstl

  1. Add the dependency for the MySQL JDBC driver too:

Figure 4.11: Adding dependency for the MySQL JDBC driver

Here is the pom.xml file after adding dependencies:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>packt.book.jee.eclipse</groupId> <artifactId>CourseManagementJDBC</artifactId> <version>1</version> <packaging>war</packaging> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.9-rc</version> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> <scope>provided</scope> </dependency> </dependencies> </project>

Note that the dependencies for servlet and JSP are marked as provided, which means that they will be provided by the web container (Tomcat) and will not be packaged with the application.

The description of how to configure Tomcat and add a project to it is skipped here. Refer to Chapter 2, Creating a Simple JEE Web Application, for these details. This section will also not repeat information on how to run JSP pages and about JSTL that were covered in Chapter 2, Creating a Simple JEE Web Application.

主站蜘蛛池模板: 静海县| 永济市| 游戏| 大石桥市| 洪江市| 夹江县| 涞水县| 峡江县| 霍邱县| 红安县| 黄冈市| 衡阳市| 安陆市| 平江县| 泾川县| 濉溪县| 蓬溪县| 措美县| 泸西县| 张北县| 湟源县| 巢湖市| 苗栗县| 聂拉木县| 岚皋县| 皮山县| 望都县| 贵定县| 广德县| 安福县| 浮梁县| 西华县| 迁安市| 北宁市| 庆阳市| 呼和浩特市| 永宁县| 郯城县| 东阳市| 云浮市| 当雄县|