Eclipse jsp页面javax.servlet.jsp.PageContext cannot be resolved to a type 错误解决办法
来源:互联网 发布:datamap 软件 编辑:程序博客网 时间:2024/05/21 07:09
我的项目使用maven构建,服务器使用的是tomcat插件,结果jsp报错javax.servlet.jsp.PageContext cannot be resolved to a type ,不影响使用,但是看着难受,最终解决了,网上说要新增lib外部引用jsp-api.jar,我直接在maven引入还是同样报错,最后在maven中加了一个属性就解决了
<dependency><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><version>2.5</version><scope>provided</scope></dependency><dependency><groupId>javax.servlet.jsp</groupId><artifactId>jsp-api</artifactId><version>2.1</version><scope>provided</scope></dependency><dependency><groupId>javax.servlet</groupId><artifactId>jstl</artifactId><version>1.1.2</version></dependency>
如上面配置中红色的就是我新加的,它的作用是
provided (已提供范围)
provided 依赖只有在当JDK 或者一个容器已提供该依赖之后才使用。例如, 如果你开发了一个web 应用,你可能在编译
classpath 中需要可用的Servlet API 来编译一个servlet,但是你不会想要在打包好的WAR 中包含这个Servlet API;这个
Servlet API JAR 由你的应用服务器或者servlet 容器提供。已提供范围的依赖在编译classpath (不是运行时)可用。它们
不是传递性的,也不会被打包。
也就是让项目用tomcat自带的servlet-api去编译,而不是去找maven配置的servlet-api,这样就不会报错了阅读全文
0 0
- Eclipse jsp页面javax.servlet.jsp.PageContext cannot be resolved to a type 错误解决办法
- Eclipse javax.servlet.jsp.PageContext cannot be resolved to a type 错误解决办法
- Eclipse javax.servlet.jsp.PageContext cannot be resolved to a type 错误解决办法
- JSP页面报javax.servlet.jsp.PageContext cannot be resolved to a type 错误
- jsp代码页面报:javax.servlet.jsp.PageContext cannot be resolved to a type错误的解决办法
- javax.servlet.jsp.PageContext cannot be resolved to a type
- javax.servlet.jsp.PageContext cannot be resolved to a type
- javax.servlet.jsp.PageContext cannot be resolved to a type
- javax.servlet.jsp.PageContext cannot be resolved to a type
- javax.servlet.jsp.PageContext cannot be resolved to a type
- javax.servlet.jsp.PageContext cannot be resolved to a type
- javax.servlet.jsp.PageContext cannot be resolved to a type
- javax.servlet.jsp.PageContext cannot be resolved to a type
- JSP页面无故报错 javax.servlet.jsp.PageContext cannot be resolved to a type
- JSP页面无故报错 javax.servlet.jsp.PageContext cannot be resolved to a type
- JSP页面无故报错 javax.servlet.jsp.PageContext cannot be resolved to a type
- jsp页面报javax.servlet.jsp.PageContext cannot be resolved to a type:
- jsp页面报错: javax.servlet.jsp.PageContext cannot be resolved to a type
- 71
- Docker容器化todaytaxi服务
- java List学习过程的一些记录
- 虚拟币开发专题(山寨币的区块链中什么是51%攻击)
- java基础1
- Eclipse jsp页面javax.servlet.jsp.PageContext cannot be resolved to a type 错误解决办法
- 【LeetCode】6. ZigZag Conversion
- 磁盘管理
- 模块度与Louvain社区发现算法
- A problem is easy
- 新的开始
- java基础2
- 字符串-POJ3974-Palindrome
- 安卓中的对称加密,非对称加密,MD5加密的算法