今天遇到一个很奇葩的问题
在启动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
分享到:
相关推荐
- **Configuration Information**: Servlets can obtain configuration information using the `ServletConfig` object, which is passed to the `init()` method during initialization. - **`ServletContext` ...
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...
当您遇到"405 - HTTP method GET is not supported by this URL"这样的问题时,通常意味着您的服务器端代码没有正确处理GET请求,或者请求被误定向到了一个不期望GET方法的Servlet。 首先,我们需要理解HTTP协议中...
The method getDispatcherType() is undefined for the type HttpServletRequest ``` 此错误表明,在编译JSP页面转换成的Java类时,遇到了问题,具体是在`HttpServletRequest`类中找不到`getDispatcherType()`方法...
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、httpsession的jar包,导入资源包。
【httpservletRequest的学习笔记】 在Java Web开发中,HttpServletRequest接口是Servlet API的核心组成部分,它用于封装客户端发送到服务器的HTTP请求。理解HttpServletRequest的工作原理对于任何Servlet开发者来说...
### 从HttpServletRequest获取各种路径总结 #### 一、概述 在Java Web开发中,通过`HttpServletRequest`对象可以获取客户端请求的各种信息,包括但不限于路径信息。这些路径信息对于开发者来说至关重要,尤其是在...
入参的HttpServletRequest必须为:import jakarta.servlet.http.HttpServletRequest; 运行cmd,再该目录下执行: 执行步骤:java -jar jakartaee-migration-1.0.1.jar commons-fileupload-1.4.jar commons-...
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 ...
* 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 内容 解析出设备来源 手机 电脑 什么种类浏览器 什么系统
在Servlet框架中,装饰模式能够解决特定问题,例如处理HttpServletRequest对象。 **问题与解决方案** Servlet Filter是一个强大的工具,可以在请求到达Servlet之前或之后进行拦截操作,如用户验证和内容压缩。然而...
Java中,引入javax.servlet.http.HttpServletRequest和javax.servlet.http.HttpServletResponse包的必备jar包:org.apache.commons.httpclient.jar
Struts2 中常用 Result 类型(type)的用法和出现的问题 Struts2 中的 Result 类型(type)是指在 Struts2 框架中用于确定 action 执行结果的方式。常用的 Result 类型有 dispatcher、redirect 和 chain 三种。这三...
* 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 * @...
// 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...
* 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 * @...
// 设置Content-Type response.setContentType("text/html;charset=UTF-8"); // 设置Expires response.setDateHeader("Expires", System.currentTimeMillis() + 3600 * 1000); // 设置一小时后过期 // 设置Last-...