Java 如何解决jsp页面中的这种错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21202763/
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-13 07:16:58  来源:igfitidea点击:

How can I resolve this kind of error in jsp page?

javamysqleclipsejspservlets

提问by

How can I resolve this kind of error in jsp page?

如何解决jsp页面中的这种错误?

<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="java.sql.*" %>

k, i understand ya, please answer my question?

k,我明白了,请回答我的问题?

the error was:

错误是:

Multiple annotations found at this line: - The import javax.servlet cannot be resolved.

在这一行发现多个注释: - 无法解析导入 javax.servlet。

采纳答案by Keerthivasan

You don't have Servlet-api.jarin your classpathof your webapplication project. Please add this jar to your Classpath.

你不必Servlet-api.jarclasspath你的web应用项目。请将此 jar 添加到您的类路径中。

Multiple Annotations found at this line:

This happens sometimes when DOM validation happens in the editor for JSP files as well

有时在编辑器中对 JSP 文件进行 DOM 验证时也会发生这种情况

回答by Qadir Hussain

Please build your project with adding servlet-api.jaravailable in your classpathalong with its .tldfile.

请通过servlet-api.jar在您classpath.tld文件中添加可用来构建您的项目。

回答by Avinash

Multiple annotations found at this line: - The import javax.servlet cannot be resolved.

在这一行发现多个注释: - 无法解析导入 javax.servlet。

if you use eclipse in case of add servlet-api.jar to javabuild path option if you don't use any edtior then set the class path of servlet-api.jar

如果您在将 servlet-api.jar 添加到 javabuild path 选项的情况下使用 eclipse 如果您不使用任何 edtior 则设置 servlet-api.jar 的类路径

this type of error only for not found the required class so please add servlet-api.jarfile

此类错误仅针对未找到所需的类,因此请添加ervlet-api.jar文件