- Java EE 8 Development with Eclipse
- Ram Kulkarni
- 227字
- 2021-06-18 19:00:06
Creating a project and setting up Maven dependencies
We will perform the following steps to create the Maven project for our application:
- Create a Maven web project as described in Chapter 2, Creating a Simple JEE Web Application.
- Name the project CourseManagementJDBC.
- Add dependencies for servlet and JSP, but do not add a dependency for JSF.
- 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
- 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.
推薦閱讀
- 新編Visual Basic程序設計上機實驗教程
- FreeSWITCH 1.6 Cookbook
- Apache Spark 2 for Beginners
- Mastering OpenCV 4
- C語言實驗指導及習題解析
- Hands-On Automation Testing with Java for Beginners
- Java程序設計案例教程
- Statistical Application Development with R and Python(Second Edition)
- Web程序設計:ASP.NET(第2版)
- Learning Jakarta Struts 1.2: a concise and practical tutorial
- SEO教程:搜索引擎優化入門與進階(第3版)
- 自己動手構建編程語言:如何設計編譯器、解釋器和DSL
- C++面向對象程序設計
- Expert Cube Development with SSAS Multidimensional Models
- Hands-On Data Visualization with Bokeh