AdSense

網頁

2017/9/28

Spring MVC form tag的預設method

Spring MVC的form tag<form:form>預設的method是POST

一般的html的form表單提交時的預設methodGET,然而從FormTag的原始碼來看,<form:form>預設的method是POST

節錄FormTag.java,若是沒有設定method,則使用預設的DEFAULT_METHOD = "post"

 /** The default HTTP method using which form values are sent to the server: "post" */
 private static final String DEFAULT_METHOD = "post";
        ...
        private String getHttpMethod() {
  return (isMethodBrowserSupported(getMethod()) ? getMethod() : DEFAULT_METHOD);
 }

沒有留言:

AdSense