`
fehly
  • 浏览: 245370 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

HTTP Status 405 - HTTP method POST is not supported by this URL

    博客分类:
  • j2ee
阅读更多

程序出现了

HTTP Status 405 - HTTP method POST is not supported by this URL

 

request.getRequestDispatcher("/servlet/GetAddServlet?id"+user_id).forward(request, response);

 

 

 解决(使用另一种跳转,myTest为项目名) 

response.sendRedirect("/MyTest/servlet/GetAddServlet?id="+user_id);

 

 

request跳转叫页面传递就是一个页面的请求传递到另外一个页面,这个你在前一个页面中对该请求的操作比如赋值,获得参数都能通过request获得。


response跳转叫页面重定向,就是你之前发过来的请求到达该处就结束了,如果还要做请求则是由该页面在重新发送一个请求了,这个请求跟之前重定向的请求不是同一个请求了,因此你通过request拿不到重定向前的请求参数    .

 -----------------------------------------网上搜集得来---------------------------------------------

forward,include,redirect是jsp中web页面(jsp或servelt)的三种不同的路由关系,三个貌似相同,其实还是有许多差别的,而了解这些细微的差别,在web开发中是很重要的。  
  说明:  
  一、forward、include由javax.servlet.RequestDispatcher来封装,由包容器container提供RequestDispatcher接口的实现,其中声明如下:

  •  void   forward(ServletRequest   req,ServletResponse   res)  
  •  void   include(ServeltRequest   req,ServletResponse   res)  

 

 可以通过两种方式得到RequestDispatcher:  


  1、ServletContext.getRequestDispatcher(String   path);  

  其中这里的path必须开始为"/",即这里的path必须相对于context的root.  


  2、ServeltRequest.getRequestDispatcher(String   path)  
  这里的path可以为相对路径,如果path开始为"/",则也认为是从context的root开始的。

  
  二、Redirect由HttpServletResponse.sendRedirect(String   location)来支持  
  差别:  


  三个都可以对用户的request进行转发,但是还是有许多的不同,差别最主要集中在如下几个方面:  

 
  1、forward与include共亨Request范围内的对象,而redirect则不行,即:如果一个javabean被声明为request范围的话,则被forward到的资源也可以访问这个javabean,而redriect则不行。  

 
  2、forward与include基本上都是转发到context内部的资源,而redirect可以重定向到外部的资源,如:   req.sendRedriect("http://www.baidu.com");

分享到:
评论

相关推荐

    http请求405错误方法不被允许的解决 (Method not allowed)

    主要介绍了http请求405错误方法不被允许的解决 (Method not allowed),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

    servlet2.4doc

    Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged. encodeUrl(String) - Method in class javax.servlet....

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    is written to stream, which is then read by the flex-property, for which the Assign method is called. - ADD: In TIdPool (module FlexUtils), added the method NextUsed (allows iterating all taken ...

    Bochs - The cross platform IA-32 (x86) emulator

    enabled automatically iff SSE4_2 is supported (like in hardware). - Make --ignore-bad-msrs runtime option in .bochsrc. Old --ignore-bad-msrs configure option is deprecated and should not be used ...

    php.ini-development

    documents, however this remains supported for backward compatibility reasons. ; Note that this directive does not control the , which can be ; used regardless of this directive. ; Default Value: On ;...

    thymeleaf-extras-springsecurity-3.0-master.zip

    This is a thymeleaf extras module, not a part of the Thymeleaf core (and as such following its own versioning schema), but fully supported by the Thymeleaf team. This repository contains two projects...

    JSP Simple Examples

    In this program we are going to know how the server determines whether the password entered by the user is correct or not. This whole process is controlled on the server side. Multiple forms in jsp ...

    BURNINTEST--硬件检测工具

    This will error faulty NICs that are not detected by the BurnInTest auto NIC detection mechanism. - Minor change to the 2D memory test when run with the 3D test (multiple large windows) and the ...

    计算机网络第六版答案

    Please do not post any solutions on a publicly-available Web site. We’ll be happy to provide a copy (up-to-date) of this solution manual ourselves to anyone who asks. Acknowledgments: Over the ...

    8-07-14_MegaCLI for linux_windows

    SCGCQ00521386 (DFCT) - Megacli : ADRA is still mentioned in help file, eventhough it is not supported SCGCQ00572235 (DFCT) - No description for "setdelay" with help file of adppr. SCGCQ00572270 (DFCT)...

    EurekaLog_7.5.0.0_Enterprise

    Later is supported when map2dbg.exe tool is placed in \Bin folder of EurekaLog installation (separate download is required) 5)....Added: Exception2HRESULT in EAppDLL to simplify developing DLLs with ...

    google api php client

    The method used is a matter of preference, but *it will be very difficult to use this library without first understanding the JSON syntax for the API*, so it is recommended to look at the [APIs ...

    Delphi7.1 Update

    When using RefreshRecord on a Memo or Blobfield and the field has been modified by another user, the blobsize of that field does not change if it is less than before (Quality Central 4676).* Calling ...

    HTTP协议详解

    10.4.6 405 不被允许的方法(Method Not Allowed) 10.4.7 406 不接受的 (Not Acceptable) 10.4.8 407 代理服务器授权所需(Proxy Authentication Required) 10.4.9 408 请求超时(Request Timeout) 10.4.10 409...

    Http1.1超文本传输协议中文版

    10.4.6 405 不被允许的方法(Method Not Allowed) 65 10.4.7 406 不接受的 (Not Acceptable) 65 10.4.8 407 代理服务器授权所需(Proxy Authentication Required) 65 10.4.9 408 请求超时(Request Timeout) 65...

    java-servlet-api.doc

    然而,一个映射可能是由一个URL和许多Servlet实例组成,例如:一个分布式的Servlet引擎可能运行在不止一个的服务器中,这样的话,每一个服务器中都可能有一个Servlet实例,以平衡进程的载入。作为一个Servlet的...

    ZendFramework中文文档

    Available options (for this frontend in Zend_Cache factory) 4.3.6.3. Examples 4.4. Zend_Cache后端 4.4.1. Zend_Cache_Backend_File 4.4.2. Zend_Cache_Backend_Sqlite 4.4.3. Zend_Cache_Backend_...

Global site tag (gtag.js) - Google Analytics