`
wujierd
  • 浏览: 46153 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

The method getDispatcherType() is undefined for the type HttpServletRequest

 
阅读更多
今天遇到一个很奇葩的问题
在启动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())


如果您有好的解决办法,麻烦贴出来。
  • 大小: 50.1 KB
  • 大小: 49.9 KB
分享到:
评论

相关推荐

    Java_for_the_Web_with_Servlets

    - **Configuration Information**: Servlets can obtain configuration information using the `ServletConfig` object, which is passed to the `init()` method during initialization. - **`ServletContext` ...

    servlet2.4doc

    The doFilter method of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain. doGet...

    java解决405 - HTTP method GET is not supported by this URL

    当您遇到"405 - HTTP method GET is not supported by this URL"这样的问题时,通常意味着您的服务器端代码没有正确处理GET请求,或者请求被误定向到了一个不期望GET方法的Servlet。 首先,我们需要理解HTTP协议中...

    JSP访问时出错

    The method getDispatcherType() is undefined for the type HttpServletRequest ``` 此错误表明,在编译JSP页面转换成的Java类时,遇到了问题,具体是在`HttpServletRequest`类中找不到`getDispatcherType()`方法...

    SCWCD-310-081.pdf

    If the `init()` method does not return within the timeout period defined by the servlet container, the container assumes that the initialization process has failed, and the servlet will not be ...

    httpservletrequest的jar包

    httpservletrequest、httpsession的jar包,导入资源包。

    httpservletRequest的学习笔记

    【httpservletRequest的学习笔记】 在Java Web开发中,HttpServletRequest接口是Servlet API的核心组成部分,它用于封装客户端发送到服务器的HTTP请求。理解HttpServletRequest的工作原理对于任何Servlet开发者来说...

    从HttpServletRequest获取各种路径总结

    ### 从HttpServletRequest获取各种路径总结 #### 一、概述 在Java Web开发中,通过`HttpServletRequest`对象可以获取客户端请求的各种信息,包括但不限于路径信息。这些路径信息对于开发者来说至关重要,尤其是在...

    tomcat10升级单个jar里面的jakarta.servlet.http.HttpServletRequest

    入参的HttpServletRequest必须为:import jakarta.servlet.http.HttpServletRequest; 运行cmd,再该目录下执行: 执行步骤:java -jar jakartaee-migration-1.0.1.jar commons-fileupload-1.4.jar commons-...

    外文翻译 stus MVC

    The purpose of Action class is to translate the HttpServletRequest to the business logic. To use Action, subclass and overwrite the process() method. The ActionServlet (Command) passes the ...

    基于JAVa的网上商城项目完整源码.zip

    * The doGet method of the servlet. * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @...

    HttpServletRequest解析设备类型和浏览器类型

    分析HttpServletRequest 内容 解析出设备来源 手机 电脑 什么种类浏览器 什么系统

    用装饰模式装饰HttpServletRequest对象

    在Servlet框架中,装饰模式能够解决特定问题,例如处理HttpServletRequest对象。 **问题与解决方案** Servlet Filter是一个强大的工具,可以在请求到达Servlet之前或之后进行拦截操作,如用户验证和内容压缩。然而...

    HttpServletRequest和HttpServletResponse的必备包

    Java中,引入javax.servlet.http.HttpServletRequest和javax.servlet.http.HttpServletResponse包的必备jar包:org.apache.commons.httpclient.jar

    struts2中常用Result类型(type)的用法和出现的问题

    Struts2 中常用 Result 类型(type)的用法和出现的问题 Struts2 中的 Result 类型(type)是指在 Struts2 框架中用于确定 action 执行结果的方式。常用的 Result 类型有 dispatcher、redirect 和 chain 三种。这三...

    java一个论坛的源码

    * The doGet method of the servlet. * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @...

    Http-servlet请求源码

    // Call the appropriate doXXX method if (method.equals(METHOD_GET)) { long lastModified = getLastModified(request); if (lastModified == -1) { // If the resource was not modified, set the response...

    网上书城 购物系统 jsp

    * The doGet method of the servlet. * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @...

    购物网站系统

    * The doGet method of the servlet. * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @...

    HTTP请求头概述(HttpServletRequest)

    // 设置Content-Type response.setContentType("text/html;charset=UTF-8"); // 设置Expires response.setDateHeader("Expires", System.currentTimeMillis() + 3600 * 1000); // 设置一小时后过期 // 设置Last-...

Global site tag (gtag.js) - Google Analytics