Maven项目中无法使用@WebServlet("")也就是import javax.servlet.annotation.WebServlet;

我们在使用idea创建的Maven项目时候,如果在Servlet中想要使用Server注解时候,需要导入这个JAR包。

        <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>javax.servlet-api</artifactId>
          <version>${servlet.version}</version>
          <scope>provided</scope>
        </dependency>

猜你喜欢

转载自blog.csdn.net/zhang6132326/article/details/105033613