Reputation: 137
I am getting Required String parameter
error if the value contains %, Could you please let me know why this is happening and a solution for this
For example if my url is localhost:8080/getsearchresult?searchparam=test
it works
But if pass % in url, spring gives me error
localhost:8080/getsearchresult?searchparam=%
then getting error and error is Required String parameter searchparam
Could you please let me know the reason behind this and would be great if suggest some solution for this
Upvotes: 0
Views: 102
Reputation: 85779
What you have here is an incomplete URL. %
is a special symbol used in URL encoding:
URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits
Not only that, but %
itself is an unsafe ASCII.
If you want to try sending %
as URL parameter, use %25
:
localhost:8080/getsearchresult?searchparam=%25
Upvotes: 2