MAVEN Series Teaching Materials (6) - Create MAVEN-style JAVA WEB Projects in ECLIPSE

MAVEN Series Teaching Materials (6) - Create MAVEN-style JAVA WEB Projects in ECLIPSE

1. Steps to use

Step 1: Create a new Maven project (by the way, remember to delete the previous j2se project)

insert image description here

Step 2: Click Next on this interface

insert image description here

Step 3: Fill in further information

insert image description here

Step 4: In this way, a web app project is obtained

But there are two problems: the java source code directory is wrong, and the index is wrong
insert image description here

Step 5: Create java source code directory

In the screenshot of the previous step, it can be found that there is no place to store java source files. At this time, you need to follow the steps below:
Right-click the project->Properties->Java Build Path->Libraries->Edit->Workspace default
JRE(jdk8)- >Finish
insert image description here

Step 6: Add the servlet jar package through pom.xml

At this time, there is still the problem that index.jsp will report an error. The solution to this problem is to add the servlet.jar package.
insert image description here
insert image description here

You can click add to add the jar package. If the input package name cannot be prompted normally, you can manually enter the code to add the jar package
insert image description here

Step 7: After adding, the index is not wrong

insert image description here

Then the classic hello world

insert image description here

Guess you like

Origin blog.csdn.net/dissplay1/article/details/111933200