Checking the Request is GET or Post
final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();
if (request.getMethod().equalsIgnoreCase("POST")){
// handle Post Request
} else {
// handle Get Request
}
//Access the Get Parameters
// pageParameters object will get in Constructor
if(pageParameters.getNamedKeys().contains("parameterName")&& parameters.get("parameterName") != null)
{
value= parameters.get("parameterName").toString();
}
//Access the Post Parameters
IRequestParameters requestParameters = getRequest().getPostParameters();
if (requestParameters != null && requestParameters.getParameterNames().contains( "parameterName" )
& requestParameters.getParameterValue( "parameterName" ) != null){
value = requestParameters.getParameterValue( "parameterName" ).toString();
}
No comments:
Post a Comment