Home > Mobile >  How to get value of query param array in spring boot?
How to get value of query param array in spring boot?

Time:07-15

I have this URL

http://127.0.0.1:3009/mac/view/:userId?ot-replace[0]=kin43

I need the value of ot-replace[0]

In the controller I am using

 @RequestParam(name="ot-replace", required=false)String[] regexReplace

Also tried using

 @RequestParam(name="ot-replace", required=false)List<String> regexReplace

I always get null. Not sure what is the issue here

CodePudding user response:

Your URL should like this.

http://127.0.0.1:3009/mac/view/:userId?ot-replace=kin43,value2,vlue3

then you can get a String[].

ot-replace[0]=kin43
ot-replace[1]=value2
ot-replace[2]=value3

CodePudding user response:

Try to use a POST methood when excute your url and set your array in the request body.

  • Related