HttpServletRequest - Get query string parameters, no form data

前端 未结 6 770
南笙
南笙 2020-12-05 09:08

In HttpServletRequest, getParameterMap returns a Map of all query string parameters and post data parameters.

Is there a way to get a Map of ONLY query

6条回答
  •  长情又很酷
    2020-12-05 10:03

    Contrary to what cularis said there can be both in the parameter map.

    The best way I see is to proxy the parameterMap and for each parameter retrieval check if queryString contains "&?=".

    Note that parameterName needs to be URL encoded before this check can be made, as Qerub pointed out.

    That saves you the parsing and still gives you only URL parameters.

提交回复
热议问题