struts2区分get/post请求

1

/**
* Struts2判断GET/POST请求
*/
String method = ServletActionContext.getRequest().getMethod();
System.out.println(method);
if (method.equals("POST")) {// 注意全部大写
System.out.println("POST请求");
} else {
System.out.println("GET请求");
}

 2、当服务器上跑一个工程时,访问index.jsp的方法是get方法

Done

原文地址:https://www.cnblogs.com/xingyyy/p/3636799.html