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

posted @ 2014-03-31 20:29  行云有影  阅读(3193)  评论(0编辑  收藏  举报