2

I have text boxes like which will have some values and i would like to create a hash map with no duplicates and send that hash map to action class.

    <input type="text" name="test1" value="test" /> 
    <input type="text" name="test2" value="test2" /> 

Like the above there will be N number of text boxes and create a hash map key as name of the text box and value as the value of the text box

would some one help me as how to do this please.

Joe
  • 4,460
  • 19
  • 60
  • 106
  • may be this will help you http://stackoverflow.com/questions/23827599/how-to-set-a-hashmap-from-jsp-to-action – Ajith John Oct 05 '15 at 08:08
  • This might help you make a HashMap in JS: [link](http://stackoverflow.com/questions/368280/javascript-hashmap-equivalent) – Peter G Oct 05 '15 at 08:09
  • There is no need for JavaScript, to do so. Just post the form to a servlet. – Stefan Oct 05 '15 at 08:11
  • @Stefan The text boxes are not static and they are dynamic that is the reason why i dont post the form if not that could be the best option. – Joe Oct 05 '15 at 08:45
  • It does not matter how they are created. – Stefan Oct 05 '15 at 08:52
  • @Stefan sorry forgot to mention that i am using struts, is it not true that struts form expect the fields name ?, would you please help as how to if Yes for struts – Joe Oct 05 '15 at 08:56
  • Maybe this helps: https://struts.apache.org/docs/processing-forms.html – Stefan Oct 05 '15 at 09:00
  • @Stefan the above link wont be useful, thanks – Joe Oct 05 '15 at 09:03

0 Answers0