servlets - Retriving map-like key-key-value from POST request -


i've been used in php can in html:

<input name="a[b][c]" value="abc"> <input name="a[b][d]" value="def"> <input name="a[d][y]" value="nope"> 

then in php e.g. as:

foreach($_post['a']['b'] $thisid => $value){     echo "key: $thisid, value: $value\n"; } 

which outputs:

key: c, value: abc key: d, value: def 

i've tried find can't seem able find equivalent in servlets. how can equivalent plain servlets (without me doing code itself)?
if doesn't exist, there library job?

edit: add sᴜʀᴇsʜ ᴀᴛᴛᴀ mentions, not want list of in request... added element in example above try make more clear.

are looking ?

    map<string, string[]> paramvalmap = req.getparametermap();   (map.entry<string, string[]> param : paramvalmap.entryset()) {     string key = (string) param.getkey();     string[] values = (string[]) param.getvalue();     out.print(key);     (string val : values) {             out.println(val);     }   } 

that map contains, each parameter , array of it's values.


Comments