本文主要是介绍request.getParameterMap获取request请求中的map参数,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、多个属性以map形式传参
2、request.getParameterMap语法获取的参数是数组形式的
3、所以我们如果需要参数以map形式作为使用,便需要遍历map数组,然后赋值给map参数,用以实现需求
4、代码
public List<Object> selInfo(HttpServletRequest request, HttpServletResponse response) {Map<String, String> ParameterMap = new HashMap<String, String>(); //map参数Map<String, String[]> map=request.getParameterMap(); //请求中的map数组for(String key :map.keySet()) { //遍历数组ParameterMap.put(key, map.get(key)[0]); //将值key,key对应的的value 赋值到map参数中}List<Object> findList = dateDao.findInfo(ParameterMap); //map传参作为使用return findList;}
这篇关于request.getParameterMap获取request请求中的map参数的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!