arianhojat Posted September 25, 2007 Share Posted September 25, 2007 Asked in java forum, but i guess they avoided me Want to do something like this in java: //visit following url: //test.php?page=1&reloadReport=true¶ms[startDate]=2/7/2003¶ms[endDate]=2/7/2003¶ms[firstName]=John&etc=could be many many unknown vars in params //and easily loop over to put in array for further processing foreach( $_GET['params'] as $key=>$val) { $params[$key] = $value; } createReport($params); //my java psuedocode: Map parameters = new HashMap(); ArrayList params = (ArrayList) request.getParameter("params"); for( String key=>value : params ) { params.put( key, value ); } createReport(params); Link to comment https://forums.phpfreaks.com/topic/70674-can-you-use-php-like-associative-form-arrays-in-java/ Share on other sites More sharing options...
Daniel0 Posted September 25, 2007 Share Posted September 25, 2007 Would this be of any use? http://java.sun.com/javase/6/docs/api/java/util/HashMap.html Link to comment https://forums.phpfreaks.com/topic/70674-can-you-use-php-like-associative-form-arrays-in-java/#findComment-355264 Share on other sites More sharing options...
arianhojat Posted September 26, 2007 Author Share Posted September 26, 2007 already looked at java apis. i think php might be unique in this regard and made it easier to look at html form vars as arrays and java just sucks Link to comment https://forums.phpfreaks.com/topic/70674-can-you-use-php-like-associative-form-arrays-in-java/#findComment-355504 Share on other sites More sharing options...
arianhojat Posted October 1, 2007 Author Share Posted October 1, 2007 I think this is what i was looking for: String[] paramValues = request.getParameterValues(paramName); for(int i=0; i<paramValues.length; i++) { out.println( paramValues ); } Link to comment https://forums.phpfreaks.com/topic/70674-can-you-use-php-like-associative-form-arrays-in-java/#findComment-359033 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.