java - how to append a list in href url? -
I want to add a list to URL which is an href, how can I do this and how do I code it .getParameter () ? Or a complete bean object in the URL?
Use the same name for each item, create something like this: http: / /example.com/somepath?amt=1&amt=2&amt=3
.
And then you can use HttpServletRequest.getParameterMap ()
. Or alternatively, you can use the HttpServletRequest.getParameterValues (name)
. You may want to use the latter by specifying the name, for example,
string [] amts = request.getParameterValues ("amt");
By the way, getParameterMap ()
gives you a map object in the form of the parameter names as it will have all other request parameters as well as your 'AMT'.
Map map = request.getParameterMap (); String [] amts = map.get ("AMT");
Comments
Post a Comment