I want to append a list in the url that is a href ,how can do so and h开发者_C百科ow can i read it using request.getParameter()
? or a complete bean object in the url ?
Use the same name for every item, build 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 HttpServletRequest.getParameterValues(name)
. You might like to use the latter by specifying the name, for example,
String[] amts = request.getParameterValues("amt");
By the way, getParameterMap()
will give you a Map object having parameter names as key. It will have all other request parameters as well as your 'amt'.
Map map = request.getParameterMap();
String[] amts = map.get("amt");
精彩评论