Jump to content

can you use php-like associative form arrays in JAVA


arianhojat

Recommended Posts

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&params[startDate]=2/7/2003&params[endDate]=2/7/2003&params[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);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.