Java zero-based self-study website, click to understand: https://how2j.cn
Aliyun server, click to learn: https://www.aliyun.com/minisite/goods
table of Contents
Step 2: Based on the previous knowledge points
Step 4: Select the maven webapp format
Step 7: Confirm the project name
Step 9: Create a new java source code directory
Step 10: download the project and unzip
Step 14: Copy the resource file
Step 1: IDEA version
Note: IDEA must use IDEA 2017. The 2018 version has a bug and cannot deploy this project.
If you must use idea 2018, you need to make the following changes:
File->Settings->Build,Execution,Deployment->Build Tools->Maven->Importing Cancel "Store generated project files externally"
so that it can be used
Step 2: Based on the previous knowledge points
This knowledge point is carried out on the basis of PageHelper , so first go to PageHelper to download the executable project and unzip it.
Note: Do not download to the runnable project of the current knowledge point.
Step 3: Create a new project
Click Create New Project to create a new project
Step 4: Select the maven webapp format
1. Select Maven on the left
2. Check Create from archetype
3. Select org.apache.maven.archetypes:maven-archetype-webapp
4. Next
Step 5: project parameters
GroupId: com.how2java
ArtifactId: ssm
Step 6: Confirm Maven path
This step will see the parameters in the Maven configuration , no need to change
Step 7: Confirm the project name
No need to change, just click Finish
Step 8: Maven import
Every time a new Maven project is created or pom.xml is changed, there will be this prompt. This time, click Enable Auto-Import to automatically import, saving trouble.
Step 9: Create a new java source code directory
The maven web project does not have a java source code directory by default, so you need to create it manually and set it as the source code directory.
Right-click the main directory -> New->Directory-> enter java-> right-click java->Mark Directory as-> Sources Root
This creates a directory for storing java source files
Step 10: download the project and unzip
This knowledge point is carried out on the basis of PageHelper , so first go to PageHelper to download the executable project and unzip it.
As shown in the figure, what you see is the directory structure of the Eclipse dynamic web project.
Note: Do not download to the runnable project of the current knowledge point.
|
Step 11: modify pom.xml
Then copy and paste pom.xml as the following code
|
Step 12: Copy web.xml
First overwrite web.xml and
copy the downloaded xxx/ssm/WebContent/WEB-INF/web.xml
to the current ssm/src/main/webapp/web.xml
Step 13: Copy JSP
Then copy the jsp directory.
Never copy the lib directory
Step 14: Copy the resource file
Copy the 3 configuration files to ssm/src/main/resources
Step 15: Copy the java file
Copy the java source code to src/main/java
Step 16: About Category.xml
According to the maven ssm project style, this file should be placed in the mapper folder of the Resource directory, but to do so, the configuration information must be modified, in order to avoid the complexity of the problem, and considering that it can work even if it is placed in the current location , So I won’t modify its position temporarily.
Step 17: configure Tomcat
Tomcat configuration and startup involve multiple steps, please refer to the previous article specifically for IDEA: Configure Tomcat
Step 18: start Tomcat
Click the green button to start Tomcat
Step 19: test
Visit the address and observe the interface as shown in the figure
|
Note: In order to use ssm in the access path, you must set the Application context/ of the Deployment of the Tomcat configuration interface to ssm, otherwise you can only use the following path to access
|
For more information, click to understand: https://how2j.cn/k/idea/idea-maven-idea-ssm-create/1397.html