Cookie Cannot be resolved to a type

Eclipse java-web项目,学习Cookie时,出现Cookie Cannot be resolved to a type问题。


(1) 尝试导入Cookie包:<%@ page import="javax.servlet.http.Cookie" %>

    问题并未解决,Cookie处仍然提示Cookie Cannot be resolved to a type,而且在Cookie包语句上提示:The import java.servlet cannot be resolved,这其实是软件包java.servlet不存在,从tomcat中导入就可以了。

(2) 其次,右键项目-->Build Path-->Configure Build Path --> Libraries -->Add Library

(3) 选择Server Runtime,单击Next按钮,再选择服务器(如Apache Tomcat v9.0),单击Finish按钮完成

猜你喜欢

转载自blog.csdn.net/qq_28026809/article/details/77934871