the method getcontextpath() from the type httpservletrequest refers to the missing type string

导入项目的时候容易报出这个错误,主要因为JRE(jdk版本不一致)。

解决方法:就是重新配置路径,配置你机器上安装的jdk。

  1. 右击该出错项目→ Build Path → Configure Build Path → 在 Libraries 选项下,会发现有个出错的jre Libraries,将其Remove掉。

2.然后右击该项目 → Build Path → Add Library, 选择JRE System Library,选择Workspace defaulr JRE(jdk1.6)(此前JDK已成功安装并配置好), 然后 Finish

这样,JSP页面中的错误提示就消失了。

原文地址:https://www.cnblogs.com/imtester/p/9512649.html