Java 错误“HttpServletRequest 指的是缺少的类型字符串”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4284700/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 15:23:13  来源:igfitidea点击:

Error "HttpServletRequest refers to the missing type String"

javajspservletsstruts2

提问by Yugal

I am implementing a project in struts in which I am getting an error in a JSP page.

我正在用 struts 实现一个项目,其中在 JSP 页面中出现错误。

I have already configured Tomcat 6, the JRE and JDK 6 in Eclipce IDE.

我已经在 Eclipce IDE 中配置了 Tomcat 6、JRE 和 JDK 6。

The code is:

代码是:

%request.getContextPath()%

The error is:

错误是:

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

How can I resolve this error?

我该如何解决这个错误?

采纳答案by Bozho

You haven't added the JRE libraries to your IDE. Add it.

您尚未将 JRE 库添加到您的 IDE。添加它。

回答by Amol Agase

click on your project and go to build path configure updated jre path and Select the library type to add

单击您的项目并转到构建路径配置更新的 jre 路径并选择要添加的库类型