Eclipse javax.servlet.jsp.PageContext cannot be resolved to a type 错误解决办法

目前在jsp页面form action中使用${pageContext.request.contextPath }/servlet的写法,但是一直提示有错误,错误如下:javax.servlet.jsp.PageContext cannot be resolved to a type
 
网上解答过说要缺少jsp-api.jar,导入这个包之后不报错了,但是程序启动访问这个页面的时候出现如下错误:
 
org.apache.jasper.JasperException: Unable to read TLD "META-INF/c.tld" from JAR file "file:/C:/Users/jason/.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLVorg.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:181)org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:182)org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:386)org.apache.jasper.compiler.Parser.parseDirective(Parser.java:449)org.apache.jasper.compiler.Parser.parseElements(Parser.java:1396)org.apache.jasper.compiler.Parser.parse(Parser.java:130)org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:185)org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)acl.demo.servlet.filter.SecurityFilter.doFilter(SecurityFilter.java:50)
 
网上说需要把jsp-api.jar去掉。。这我就不会了。这不是互相矛盾了么?
 
经过再三试验,解决方法如下:
不要 直接将jsp-api.jar拷贝到lib目录下,而是通过外部jar包引用。
项目 右键->Properties->Libraries->Add External JARS-
选择 外部的jsp-api.jar(tomcat6的lib目录下有)。


时间: 2024-10-06 09:56:28

Eclipse javax.servlet.jsp.PageContext cannot be resolved to a type 错误解决办法的相关文章

maven中解决javax.servlet.jsp.PageContext cannot be resolved to a type

在eclipse环境下用maven出现:javax.servlet.jsp.PageContext cannot be resolved to a type. 这是因为没有引入jsp-api引发的问题,在pom.xml引入: <dependency> <span style="white-space:pre"> </span><groupId>javax.servlet</groupId> <artifactId>

javax.servlet.jsp.PageContext cannot be resolved to a type

<dependency> <groupId>javax.servlet</groupId> <artifactId>jsp-api</artifactId> <version>2.0</version> <scope>provided</scope> </dependency> 提供jsp-api的支持即可解决该问题. 注:provided 因为tomcat等容器中有该jar包,comp

解决javax.servlet.jsp.JspException cannot be resolved to a type

java开发工具 在导入新项目后出现 javax.servlet.jsp.JspException cannot be resolved to a type错误信息: 解决方案: 看看项目中是否存在jsp.api.jar包.若是不存在就去tomcat中copy一份  jsp.api.jar包到项目lib中 The import javax.servlet.http.HttpServletRequest cannot be resolved 错误信息 解决方案: 看看项目中是否存在servlet.

javax.servlet.jsp.JspException cannot be resolved to a type

在你的项目中加入jsp-api.jar和servlet-api.jar包,这两个包来源于tomcat的libs目录中,但是会出现一个问题,项目打包发布的时候也会将这两个jar打包出去,这时候发布到tomcat中后tomcat可能启动失败,同时你的jar包可能和tomcat中的jar版本不一致等情况. 解决方式:右键你的项目--properties选择Targeted Runtimes,选择你的运行环境,我选择Apache Tomcat v7.0,Apply--OK. 原文地址:https://w

The import javax.servlet.jsp.JspException cannot be resolved

问题描述 ??重新更换了 Apache Tomcat 的版本,在 Eclipse 中项目报错信息:The import javax.servlet.jsp.JspException cannot be resolved 解决方法 ??重新配置一下工程路径,配置服务器. Eclipse -> Project -> Clean... 一下工程; 右键 工程项目 -> Build Path -> Configure Build Path... -> Java Build Path

jsp使用c:forEach报错 javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext的问题

今天发现了一个折磨我一天的问题: 在jsp文件中使用 <c:forEach items="${checkResult}" var="item"> </c:forEach> 一直报错: [ERROR] 2013-12-09 15:03:20,740 method:org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:253) Servlet.

- The import javax.servlet.jsp.JspWriter cannot be resolved

 Add servlet-api.jar and jsp-api.jar from Tomcat 6.0 library to ecipse project.- The import javax.servlet.jsp.JspWriter cannot be resolved

eclipse中 报出The type javax.servlet.http.HttpServlet cannot be resolved. It is indirect错误

在Myeclispe部署项目后 报错 The type javax.servlet.http.HttpServlet cannot be resolved. It is indirect错误 如果在MyEclipse中遇到这种情况,也就是HttpServletRequest报红叉的时候,这样做1.右键工程找到build path项2.找到Add Libraries3.点击myEclipse Libraries,Next4.添加JavaEE 5OK

javax.servlet.jsp.JspException cannot be resolved

加入以下,解决 <properties> <jdk.version>1.6</jdk.version> <spring.version>3.2.8.RELEASE</spring.version> <spring.security.version>3.2.3.RELEASE</spring.security.version> <!-- Web --> <jsp.version>2.1</jsp