在项目中有时需要验证用户是否以post方式提交。下面是验证源码:
public boolean checkMethod(String method) {
if (request.getMethod().equalsIgnoreCase(method)) {
return true;
}
else {
return false;
}
}
调用方式 checkMethod("post").如果以post方式提交为true,否则为FALSE。
原文地址:http://blog.csdn.net/zl544434558/article/details/24648401