打开spring项目后.jsp文件出现红色叉叉( java新工程导入eclipse常见问题---Multiple annotations found at this line)

1…jsp文件出现红色叉叉
如图
打开spring项目后.jsp文件出现红色叉叉( java新工程导入eclipse常见问题---Multiple annotations found at this line)

Multiple annotations found at this line:

  • java.io.IOException cannot be resolved to a type
  • String cannot be resolved to a type
  • java.io.IOException cannot be resolved to a type
  • String cannot be resolved to a type
  • The type java.util.Map cannot be resolved. It is indirectly referenced from
    required .class files
  • The method getScheme() from the type ServletRequest refers to the missing type
    String
  • The type java.util.Map cannot be resolved. It is indirectly referenced from
    required .class files

2.报错信息
Multiple annotations found at this line:

  • The method getContextPath() from the type HttpServletRequest refers to the
    missing type String
  • The method getContextPath() from the type HttpServletRequest refers to the
    missing type String

3.出错原因原作者版本与你电脑上jdk版本不一致

4.解决方法
4.1对于eclipse
①.右键工程->Build Path -> Configure Build Path , 在 Libraries 选项下,会发现有个出错的jre Libraries,将其Remove掉。
打开spring项目后.jsp文件出现红色叉叉( java新工程导入eclipse常见问题---Multiple annotations found at this line)
②.然后右击该项目 - Build Path - Add Library, 选择JRE System Library,选择添加的版本,之后一路ok即可
打开spring项目后.jsp文件出现红色叉叉( java新工程导入eclipse常见问题---Multiple annotations found at this line)4.2对于STS(Spring Tool Suite)
①右键工程->properties->之后步骤和4.1一样了。