javax.servlet.jsp.PageContext cannot be resolved to a type
程序员文章站
2022-07-12 13:28:03
...
在编写jsp时,如下代码中的pageContext会报一个错误。
<a href="${pageContext.request.contextPath }/comm/activate_user">激活用户数</a>
错误:
javax.servlet.jsp.PageContext cannot be resolved to a type
原因与解决:编写时候报错,当时发布到jetty后能正常运行,这是因为jetty中有jsp-api.jar。
所以,解决方法就是将jetty安装目录下的jsp-api.jsp(tomcat中也有)复制到工程的lib目录下。
然后打个空格,重新保存一下jsp文件就可以了。
maven中添加一下依赖:
<dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> <scope>provided</scope> </dependency>
上一篇: Java资源文件的读取总结
推荐阅读
-
PHP错误Cannot use object of type stdClass as array in错误的解决办法
-
PHP JSON出错:Cannot use object of type stdClass as array解决方法
-
遇见“The absolute uri: [http://java.sun.com/jsp/jstl/core] cannot be resolved..”怎么办
-
JSP报错javax.servlet.jsp.JspException cannot be resolved to a type solution
-
IOS开发遇到Interface type cannot be statically allocated 问题的解决办法
-
TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type s
-
TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type s
-
configure: error: cannot guess build type; you must specify one
-
The instance of entity type ‘xxx‘ cannot be tracked because another instance with the same key value
-
SpringBoot项目在启动时出现了Cannot determine embedded database driver class for database type NONE 错误