I have this servlet that accepts dynamic parameter names in the query string, but the query string is also appended other parameters by some javascript plugin.
Here's the request scenario:
http://foo.com/servlet?[dynamic param]=[param value]&[other params]=[other values]...
I'd like to be able to read the first parameter, so then the servlet will carry out its execution depending on the dynamic param name, or do nothing if it doesn't recognize the param name. I'm 100% certain that the first param name is always the dynamic one, because I control the query string construction thru an ajax call.
The problem I've encountered is that HttpRequestServlet.getParameterMap()
or .getParameterNames()
ordering doesn't always correspond to the query string order, so the servlet does nothing half/most of the time depending on the frequency of parameters.
How do I always read the first param in a query string?