This project was taken from the online exam https://github.com/Eliteteams/q...
But when IDEA is compiled, an error occurs: Cannot resolve symbol 'HttpServletRequest''HttpServletResponse' 'Cookie'
I have these three jars. The strange thing is that when my project runs, the correct page pops up. What is wrong with this? Already?
代言2017-06-12 09:21:29
Add this sentence to pom.xml
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
Setting scope to provided means that the running environment has been provided and is only used for compilation and will not be packaged.
It is not recommended to put the servlet on the classpath, after all, different projects may require different versions.
Additional sentence: Please select the servlet-api version according to the project's web.xml, or select a new servlet-api version to modify the header of web.xml
世界只因有你2017-06-12 09:21:29
This is a maven project, there is no need to manually import packages. Right click on the project MAVEN->Update Project
阿神2017-06-12 09:21:29
The compilation environment does not have javax.servlet-api.jar
The operating environment has this
Add javax.servlet-api.jar