HttpServletRequest 类型的 getDispatcherType() 未定义 [英] getDispatcherType() is undefined for the type HttpServletRequest

查看:42
本文介绍了HttpServletRequest 类型的 getDispatcherType() 未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将 Java 动态 Web 项目导入 Eclipse IDE(已在 Eclipse IDE 中实现并正常工作).

I have imported a Java dynamic web project into the Eclipse IDE (which was implemented in Eclipse IDE and properly working).

我在运行项目时收到getDispatcherType() 未定义类型HttpServletRequest"错误.

I'm getting a "getDispatcherType() is undefined for the type HttpServletRequest" error while running the project.

我已按照结构将每个文件复制到 IDE 中,工作已完成.

I have copied every file into IDE as per the structure and the work is done.

现在我只想知道为什么在导入项目时会出现此错误.有没有人遇到过同样的问题?请让我知道我可能犯了什么错误.

Now I just want to know why I am getting this error when I have imported the project. Did anyone faced the same issue? Please let me know what mistake I might have made.

推荐答案

当我在 IntelliJ 中使用的 servlet-api 版本与 Tomcat 8.0.x 支持的版本相冲突时,我遇到了同样的问题...我正在使用 Maven,所以我只是将我的依赖项更改为这个,然后对我的 webapp 进行了干净的部署,问题就消失了.

I had the same issue when I had a conflicting servlet-api version I was using in IntelliJ that conflicted with what was supported in Tomcat 8.0.x... I was using Maven, so I just changed my dependency to this, then did a clean deploy of my webapp and the problem went away.

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.1.0</version>
</dependency>

这篇关于HttpServletRequest 类型的 getDispatcherType() 未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆