ITeye博客

The method getDispatcherType() is undefined for the type HttpServletRequest

wujierd · 2014-12-17 23:56 · 编程语言 · Markdown

今天遇到一个很奇葩的问题 在启动tomcat的时候出现如下问题。 The method getDispatcherType() is undefined for the type HttpServletRequest。 就是在HttpServletRequest没有定义getDispatcherType方法,我看了在HttpServletRequest里面确实没有getDispatcherType方法。servlet 3.0.1 和servlet 3.1.0都没有

在ServletRequestWrapper里面才有

但是出问题的login_jsp.java是这样的


  public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
        throws java.io.IOException, javax.servlet.ServletException {

final java.lang.String _jspx_method = request.getMethod();
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD");
return;
}

我只能把如下的代码删掉


&& !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())

如果您有好的解决办法,麻烦贴出来。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。