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

来源:互联网 发布:windows 高精度sleep 编辑:程序博客网 时间:2024/04/25 09:22

今天我将一个项目从另一台机器拷到这台机器,又重新安装了JDK1.6(这台机器上原先的JDK是1.5的),并配置好了JDK环境后,我将整个项目部署好之后,在每个JSP页面中的"request.getContextPath()"下方出现了红色的波浪线,提示的错误信息是“The method getContextPath() from the type HttpServletRequest refers to the missing type String”,

    此时,我们只需这样:

    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页面中的错误提示就消失了。

0 0