Is there a way to know in Struts2 action's method if this is GET or POST request?
Your action should implent org.apache.struts2.interceptor.ServletRequestAware
, so your action class should have something like
private HttpServletRequest httpRequest;
// ...
public void setServletRequest(HttpServletRequest request) {
this.httpRequest = request;
}
Then just do:
String method = httpRequest.getMethod() ;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With