MyEclipse开发项目时遇到HttpServletResponse报红叉怎么办?

今天写代码时,发现HttpServletResponse response = ServletActionContext.getResponse();这句报红叉,提示The type javax.servlet.http.HttpServletResponse cannot be resolved. It is indirectly referenced from required .class files,并要求configuration build path,经过尝试之后,发现解决办法。

错误情况:HttpServletResponse response = ServletActionContext.getResponse();这句报红叉

提示:The type javax.servlet.http.HttpServletResponse cannot be resolved. It is indirectly referenced from required .class files,并要求configuration build path

解决办法:点击提示中的configuration build path(或者右键项目,点击Build Path->configuration build path),打开build path界面后,选择Libraries选项卡,并单击Add Library,如图

选择MyEclipse Libraries,点击Next

找到Java EE 5,点击Finish

再看代码,红叉已经解决

(0)

相关推荐