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); Quote 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 Quote 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 Quote 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 ); } Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.