方式一:配置IDEA
1. 打开项目结构对话框:File -> Project Structure
2. 配置IDEA的 Platform Setting -> Global Libraries 或 Project Settings -> Libraries
方式二:【推荐】配置pom.xml文件
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++--> <!-- Servlet环境:引入servlet-api和jsp-api --> <!--++++++++++++++++++++++++++++++++++++++++++++++++++++--> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> <scope>provided</scope> </dependency>