If you look at the docs of the Request#getParameterMap()
, it returns a Map
of the type Map<String, String[]>
. Therefore, you need to take out the first element from the value String[]
array returned from the map.
String id = params.get("id")[0];
Ofcourse, you can avoid all this and directly get the parameters from the request objects using the Request#getParameter()
method.
String id = request.getParameter("id");
Edit: Looking at your class code, it seems that the instance variable request
is not initialized. Initialize that in the constructor like this:
public AnalyzerController(HttpServletRequest request)
{
this.request = request; // Initialize your instance variable request which is used in the other methods.
this.params = request.getParameterMap();
this.pathInfo = request.getPathInfo();
}