You should use the method equalsIgnoreCase:
public String getRequestParameter(HttpServletRequest request, String parameter){
for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) {
if(entry.getKey().equalsIgnoreCase(parameter)){
return entry.getValue()[0];
}
}
return null;
}
or if you have a query as an instance variable:
public String getRequestParameter(String parameter){
for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) {
if(entry.getKey().equalsIgnoreCase(parameter)){
return entry.getValue()[0];
}
}
return null;
}
source
share