Java getQueryString
-
02-10-2019 - |
Question
So i'm trying to capture a certian section of a getQueryString(). I know I could try and go through and parse the string to get the certain section I wanted but was hoping to just be able to grab the piece I need.
Here is my query result:
N=0&Ntk=General&Ntt=info&Nty=1&D=info&Ntx=mode+matchallpartial&Dx=mode+matchall
I'm looking just to capture this part: Ntt=info
The =info
part will change to whatever the search requested was.
I have gone through a lot of the API request function and haven't found anything that works for me.
Am I just going to have to parse it?
Solution
Use ServletRequest.getParameter
req.getParameter('Ntt');
It will return null if the parameter isn't set.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow