idea no new servlet

 

IDEA right click to create servlet, there is no solution for servlet option

1. Problem description

  I was writing a javaweb project recently, using jsp+servlet+sql server, but after creating the project in IDEA, when building the structure, there is no option to create a servlet file. Searching the Internet for a long time, I found a lot of similar blogs saying that it is necessary to add the JSP and servlet jar in Tomcat in the dependencies. But I didn't use maven, I created the lib file under the web and put the required jar file.

  You can see that in the picture I posted, two related jars are introduced, but there is still no servlet option in the right-click creation. Then the problem is, is there a problem with the two jars I imported? no!

There is no servlet option in the picture.

2. Solution

After rethinking my thinking, I thought that I should start with the configuration of the project, so I came back to the configuration page

2.1. Mark src as Sources file

2.2. In the sources root of the facets configuration, check src

3). That is, the configuration is correct, you can create a new servlet file in the file under the src directory.

3. Summary

3.1. When encountering problems specific to this type of editor, first check whether your configuration is correct;

3.2. IDEA will identify the file according to the mark in the configuration, and then give the user an option.

 

Guess you like

Origin blog.csdn.net/qq_34626094/article/details/113005341